简体   繁体   中英

angular 4 - How to fix white screen after deploy

I deploy my angular4 app with this command:

ng build --progress --optimization --stats-json --verbose --build-optimizer --aot --configuration=prod
but after that in some cases, screen got white and in the console it say:
Uncaught SyntaxError: Unexpected token < main.abf....js:1
and when I look at the page source, main.abf....js file does not exist.I open the page in Choome Incogtino Tab and It loades correctly and the main.js file loaded is another file like this main.222aa2da0bf59086f2ba.js


Sounds like your browser is caching the files and incognito does not load from cache. You can try adding the "--output-hashing=all" flag to your build to cachebust your files when there are changes. Try changing your ng build to look like this:

ng build --progress --optimization --stats-json --verbose --build-optimizer --aot --configuration=prod --output-hashing=all

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM