我有一个 Angular 运行时,它在确定的路径下运行,例如 https://host:port/path/
当我加载应用程序并运行 ngsw-cache-bust 时,它会忽略路径并直接从根路径 https://host:port/script.js 获取脚本,而不是从https://host:port/path/script.js 获取脚本
我通过运行 ng add @angular/pwa 添加了 PWA
我尝试过注册多种方式,例如 /ngsw-worker.js 或 ./ngsw-worker.js,但似乎都没有解决问题
我们使用 Angular 7.2.0
ngsw-config.json 如下所示:
`
{
"index": "/index.html",
"routes": {
"/": {
"prefix": false
},
"/scripts": {
"prefix": true
},
"/libraries": {
"prefix": true
}
},
"assetGroups": [
{
"name": "app",
"installMode": "prefetch",
"resources": {
"files": [
"./favicon.ico",
"./index.html",
"./*.css",
"/**.js"
]
}
}, {
"name": "assets",
"installMode": "lazy",
"updateMode": "prefetch",
"resources": {
"files": [
"/assets/**",
"/*.(eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2|ani)"
],
"urls": [
"https://fonts.googleapis.com/**"
]
}
}
]
}
任何帮助都将不胜感激!