-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathworkbox-config.js
35 lines (35 loc) · 948 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
module.exports = {
swDest: 'public/sw.js',
runtimeCaching: [{
// Match any same-origin request that contains 'api'.
urlPattern: new RegExp(/https\:\/\/gateway\.marvel\.com\/v1\/public\/.+/g),
handler: 'cacheFirst',
options: {
// Use a custom cache name for this route.
cacheName: 'api-cache',
// Configure custom cache expiration.
expiration: {
maxEntries: 20,
maxAgeSeconds: 36000,
},
// Configure which responses are considered cacheable.
cacheableResponse: {
statuses: [0, 200]
},
},
},
{
urlPattern: new RegExp(/https\:\/\/gateway\.marvel\.com\/v1\/public\/.+/g),
handler: 'staleWhileRevalidate',
options: {
cacheableResponse: {
statuses: [0, 200]
}
}
}],
clientsClaim: true,
skipWaiting: true,
globPatterns: ['**/*.{js,html,css,woff2,woff,svg}'],
globFollow: false,
globDirectory: './public/'
}