问题
Service worker doesn't work after deploy to Azure. My json:
{
"index": "/index.html",
"assetGroups": [
{
"name": "app",
"installMode": "prefetch",
"resources": {
"files": [
"/index.html"
],
"versionedFiles": [
"/*.bundle.css",
"/*.bundle.js",
"/*.chunk.js"
]
}
},
{
"name": "assets",
"installMode": "lazy",
"updateMode": "prefetch",
"resources": {
"files": [
"/assets/**",
"favicon.ico"
]
}
}]}
In .angular-cli.json added "serviceWorker": true
In app.module.ts added ServiceWorkerModule.register('/ngsw-worker.js', { enabled: environment.production })
Run build, run http-server and get:
After deploy to Azure get:
来源:https://stackoverflow.com/questions/61871020/service-worker-angular-5