Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

angular-cli - run index.html directly from dist?

Tags:

angular-cli

Not sure if this can work. Created new angular-cli project, run ng serve and opened browser. It worked.

Run ng build --prod, created dist folder with index.html and number of js bundles.

I then opened index.html in browser. Hangs waiting for javascript (so I just see "loading ...").

Should this work? And if not, could someone explain why?

like image 817
John Avatar asked Sep 19 '16 12:09

John


1 Answers

You should not just open this file. Web server is what you need for production usage.

If you want to serve build version of application using built in server, you can use ng serve --prod command.

like image 184
rzelek Avatar answered Oct 02 '22 12:10

rzelek