我正在尝试在我的Angular应用中一起实现angular通用服务和service worker。我的问题是,当我部署更新时,它已经几天都没有更新。我仍然看到我的应用程序的旧视图。这是我在ngsw-config.json中所做的。我不能将maxAge放在assetGroups中。我只能将其放在dataGroups上,这就是为什么它仍呈现旧视图的原因?请启发我。
{
"$schema": "./node_modules/@angular/service-worker/config/schema.json",
"index": "/index.html",
"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)"]
}
}
],
"dataGroups": [
{
"name": "caching api",
"urls": ["backend-api/*"],
"cacheConfig": {
"maxSize": 100,
"maxAge": "6h",
"timeout": "10s",
"strategy": "freshness"
}
}
]
}