Skip to content

Commit 7396b40

Browse files
committed
fix: add version to cacheId + add package.json to SW caching
1 parent c0bfb3d commit 7396b40

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed
Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
1+
const packageJson = require('./package.json');
2+
13
module.exports = {
2-
cacheId: 'compas',
4+
cacheId: `compas-${packageJson.version}`,
35
globDirectory: 'build/',
46
globPatterns: [
57
'_snowpack/**/*.{md,js,png,xml,pdf,css,html,info,json,ico,svg,wasm}',
68
'public/**/*.{md,js,png,xml,pdf,css,html,info,json,ico,svg,wasm}',
79
'src/**/*.{md,js,png,xml,pdf,css,html,info,json,ico,svg,wasm}',
810
'*.{md,json,ico,xml}',
11+
'package.json.proxy.js',
912
],
1013
globIgnores: [
1114
'public/nsdoc/README.md'
1215
],
1316
swDest: 'build/sw.js',
1417
runtimeCaching: [
18+
{
19+
urlPattern: /package\.json\.proxy\.js$/,
20+
handler: 'NetworkOnly',
21+
},
1522
{
1623
urlPattern: /\/(_snowpack|public|src)\/.*/,
1724
handler: 'NetworkFirst',
@@ -20,10 +27,11 @@ module.exports = {
2027
fetchOptions: {
2128
credentials: 'include',
2229
},
23-
}
30+
},
2431
},
2532
],
2633
skipWaiting: true,
34+
clientsClaim: true,
2735
inlineWorkboxRuntime: true,
2836
cleanupOutdatedCaches: true,
2937
};

0 commit comments

Comments
 (0)