U
U
user.2019-02-21 22:22:30
Angular
user., 2019-02-21 22:22:30

Angular2 how to start my frontend after doing ng build?

Good evening,
I'm starting to understand Angular2, Actually, the question is, after running ng build in the dist folder, I get a bunch of html / css / js when I try to run index.html, nothing happens, actually tell me how to use the html / js / css issued by Angular? Sori if the question seems ridiculous to knowledgeable people.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Shvets, 2019-02-21
@Xuxicheta

In html, links to compiled js and css will be relative.
Depending on the browsers and the operating system, the behavior will be different, on Linux, for example, the browser tries to open them as file:///main.4cc3c8d8152162fe9b99.bundle.js, for example, i.e. instead of a local directory, it looks for my js file in the root of the file system, where of course it does not exist.
Of course, nothing opens.
To see it normally, you need to put the entire dist at the disposal of some web server, for example http-server, as advised above (and the webpack launched by ng serve does the same). nginx or apach or lighttpd will do, or even IIS if you can set them up.
Or hosting.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question