-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathworkbox-config.js
45 lines (44 loc) · 1011 Bytes
/
workbox-config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
const { hash } = require('./src/ts/generated/hash.json');
const ignore = /^\/((a(pi(\d?|-tools)|uth|dm(in)?)|(bl|m)ep)|tools|reload)\/|\.html|^\/sw\.js$/;
module.exports = {
globDirectory: 'build/',
globPatterns: [
'**/*.{js,css,png,jpg,wasm}',
],
globIgnores: [
'**/assets-admin/**',
'**/bootstrap-es*',
'**/bootstrap-tools*',
'**/style-tools*',
'**/style-inline*',
'**/sw.min.js',
],
dontCacheBustURLsMatching: /-[a-f0-9]{10}\./,
swDest: 'build/sw.js',
navigateFallback: '/',
navigateFallbackBlacklist: [ignore],
maximumFileSizeToCacheInBytes: 10 * 1024 * 1024, // 10 MB
// importWorkboxFrom: 'local',
skipWaiting: true,
clientsClaim: true,
templatedURLs: {
'/': hash,
},
directoryIndex: '/',
runtimeCaching: [
{
urlPattern: ignore,
handler: 'NetworkOnly',
},
{
urlPattern: /^\/assets\/music/,
handler: 'CacheOnly',
options: {
cacheName: 'music-cache',
expiration: {
maxAgeSeconds: 1000 * 3600 * 24 * 30, // 30 days
},
},
},
],
};