简体   繁体   中英

Angular Service Worker not working with --base-href in build proccess

I want to include the ngsw in my build so that create offline verion of the application. In the build script in the package.json I have next: "build": "ng build --prod --base-href /test/" The generated ngsw.json have the files that are "/test/index.html" . As I can judge it assumes that I am on the localhost:3000 , but i use localhost:3000/test , so that I got lots of errors. How to fix this issue?

您需要用ng build --prod --base-href=/test/代替"build"

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