preboot / angular-webpack

A complete, yet simple, starter for Angular v2+ using webpack
MIT License
1.29k stars 556 forks source link

[Question] Is a web-server needed to run the production (dist) project? #317

Closed arthur-melo closed 7 years ago

arthur-melo commented 7 years ago

I'm trying to run the production project directly from the browser (Opening up the generated index.html), but it gets stuck in the "Loading..." page from the root component. The console doesn't output anything, either.

If I launch a web server, let's say Python's SimpleHTTPServer, and access it from the browser (IP:Port), the page loads up normally. I was wondering, is this behaviour by design? Or is it related to Angular/SPAs/this project only?

All I did was clone the repo, install deps and build the distribution version by using npm run build.

Am I missing something? Thanks.

dannypule commented 7 years ago

Hi Arthrmlo, yes a web server of your own choosing is needed to run this in production. Your dist folder has all the html, css, js and asset files necessary for you to use any server of your choosing. Even a simple node server which serves and index file for all (*) requests will work.

arthur-melo commented 7 years ago

Hi @dannypule, thanks for answering. I've looked up a bit more on why a web server is it needed and found a more in-depth answer on stack overflow. Here is the link for anyone who might have the same question: http://stackoverflow.com/a/34587117.

I'm closing this issue.