-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathworkbox-config.js
40 lines (40 loc) · 1006 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
module.exports = {
globDirectory: "dist",
globPatterns: [
// core code
"**/*.{html,js,css}",
// images
"**/*.{png,webp,svg,ico}",
"**/*.{json,woff,woff2,webmanifest}",
],
maximumFileSizeToCacheInBytes: 6000000, // 5MB
ignoreURLParametersMatching: [/^id$/, /^page$/, /^json$/, /^utm_/],
dontCacheBustURLsMatching: /.*\.[a-f0-9]{8}\..*/,
runtimeCaching: [
{
urlPattern: /^https:\/\/fonts\.googleapis\.com/,
handler: "StaleWhileRevalidate",
options: {
cacheName: "google-fonts",
},
},
{
urlPattern: /^https:\/\/fonts\.gstatic\.com/,
handler: "CacheFirst",
options: {
cacheName: "google-fonts",
cacheableResponse: {
statuses: [0, 200],
},
expiration: {
maxAgeSeconds: 60 * 60 * 24 * 365,
maxEntries: 30,
},
},
},
],
swDest: "dist/service-worker.js",
clientsClaim: false,
skipWaiting: false,
offlineGoogleAnalytics: true,
};