-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathworkbox-config.js
37 lines (37 loc) · 957 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
module.exports = {
globDirectory: '.svelte-kit/output/client/',
globPatterns: [
'**/*.{html,json,js,css,svg,png,ico,txt}'
],
swDest: '.svelte-kit/output/client/service-worker.js',
clientsClaim: true,
skipWaiting: true,
// Don't cache Google Fonts and other dynamic resources
navigateFallback: '/index.html',
navigateFallbackDenylist: [/^\/api\//],
runtimeCaching: [
{
urlPattern: /^https:\/\/www\.youtube\.com\//,
handler: 'StaleWhileRevalidate',
options: {
cacheName: 'youtube-cache',
expiration: {
maxEntries: 10,
maxAgeSeconds: 24 * 60 * 60 // 24 hours
}
}
},
{
// Cache other dynamic content
urlPattern: /\.(js|css|json)$/,
handler: 'StaleWhileRevalidate',
options: {
cacheName: 'dynamic-resources',
expiration: {
maxEntries: 50,
maxAgeSeconds: 24 * 60 * 60
}
}
}
]
};