Angular-cli: is it normal to have dist/index.html showing white page ?

Created on 8 Mar 2017  路  10Comments  路  Source: angular/angular-cli

after executing the build, what is the proper way to test if the build is ok without interacting with a web server. opening dist/index.html displays a white page and I can't explain why ?

Most helpful comment

IF you look at the console it will show errors trying to get the files. it is an issue with paths to resources

All 10 comments

@amineparis you will need to have a server running so that the page can fetch the required resources.

If you want to test your production build using the build in dev server you can run.

ng serve --prod

For future reference the angular cli gitter channel would be a better place to ask questions like this.

why directly opening dist/index.html displays white page knowing that it is only html/css/js ?

IF you look at the console it will show errors trying to get the files. it is an issue with paths to resources

thank you ! PS : I am wondering on how to thank someone on github other than poluting the issue with a useless comment like this one ?

haha. unfortunately I don't know of great way. :)

I was facing the same issue when trying to render index.html file from dist folder, I a figure out that there was issue with specifying the static filles to the express server. So you should dobule check if you are specifying correctly the static folder to express server where the index.html file resides.

I think you should change the value of <base> tag in the index.html file.

comment out the <base> tag and try it again for testing it. I would also manually set the base tag href when building the /dist folder try setting it within the command:

ng build --base-href domain.com/whatever/ --prod

I followed following command to test service worker in my angular 7 project.

ng build --prod
cd dist/appname
http-server -p 8082

image

And page showing like this
image

how to fix

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sysmat picture sysmat  路  3Comments

jmurphzyo picture jmurphzyo  路  3Comments

daBishMan picture daBishMan  路  3Comments

rajjejosefsson picture rajjejosefsson  路  3Comments

delasteve picture delasteve  路  3Comments