Skip to content

Commit 48068fe

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

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed
Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
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
],
10-
globIgnores: [
11-
'public/nsdoc/README.md'
12-
],
13+
globIgnores: ['public/nsdoc/README.md'],
1314
swDest: 'build/sw.js',
1415
runtimeCaching: [
16+
{
17+
urlPattern: /package\.json\.proxy\.js$/,
18+
handler: 'NetworkOnly',
19+
},
1520
{
1621
urlPattern: /\/(_snowpack|public|src)\/.*/,
1722
handler: 'NetworkFirst',
@@ -20,10 +25,11 @@ module.exports = {
2025
fetchOptions: {
2126
credentials: 'include',
2227
},
23-
}
28+
},
2429
},
2530
],
2631
skipWaiting: true,
32+
clientsClaim: true,
2733
inlineWorkboxRuntime: true,
2834
cleanupOutdatedCaches: true,
2935
};

0 commit comments

Comments
 (0)