I do not understand what's wrong with a clean&basic setup of Angular+PWA. Every time I visit my webpage I need to fetch actual&latest /assets/fakit.json
file without any caching. But as a result, (btw 200 OK) I see that this file is coming from service worker: I tried a lot of ngsw configs, but this particular file is outdated in a lot of cases. Sometimes it's refreshed only via ctrl+f5
in chrome.
My ngsw-config.json looks so:
{
"$schema":"./node_modules/@angular/service-worker/config/schema.json",
"index":"/index.html",
"assetGroups":[
{
"name":"app",
"installMode":"prefetch",
"resources":{
"files":[
"/favicon.ico",
"/index.html",
"/manifest.webmanifest",
"/*.css",
"/*.js"
]
}
},
{
"name":"assets",
"installMode":"prefetch",
"updateMode":"prefetch",
"resources":{
"files":[
"/assets/**",
"!/*.json"
]
}
}
],
"dataGroups":[
{
"name":"version",
"urls":[
"/assets/fakit.json",
"/assets/lang/fr.json"
],
"cacheConfig":{
"maxSize":10,
"maxAge": "0",
"timeout":" 1000",
"strategy":"freshness"
}
}
]
}
also I tried it so:
{
"$schema": "./node_modules/@angular/service-worker/config/schema.json",
"index": "/index.html",
"assetGroups": [
{
"name": "app",
"installMode": "prefetch",
"resources": {
"files": [
"/favicon.ico",
"/index.html",
"/manifest.webmanifest",
"/*.css",
"/*.js"
]
}
},
{
"name": "assets",
"installMode": "prefetch",
"updateMode": "prefetch",
"resources": {
"files": [
"/assets/**",
"/*.(svg|cur|jpg|jpeg|json|png|apng|webp|avif|gif|otf|ttf|woff|woff2)"
]
}
}
]
}
What did I do wrong? How can I disable any kind of cache for my PWA Angular app & *.json
files? It happens on mobile & browsers as well.
Comments
Post a Comment