-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathworkbox-config.cjs
More file actions
33 lines (33 loc) · 865 Bytes
/
workbox-config.cjs
File metadata and controls
33 lines (33 loc) · 865 Bytes
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
// workbox-config.js
module.exports = {
globDirectory: "dist",
globPatterns: ["**/*.{html,js,css,png,jpg,svg,woff,woff2}"],
swDest: "dist/service-worker.js",
runtimeCaching: [
{
urlPattern: ({ request }) => request.destination === "image",
handler: "CacheFirst",
options: {
cacheName: "images-cache",
expiration: {
maxEntries: 50,
maxAgeSeconds: 30 * 24 * 60 * 60, // 30 days
},
},
},
{
urlPattern: ({ request }) => request.destination === "script" || request.destination === "style",
handler: "StaleWhileRevalidate",
options: {
cacheName: "static-resources",
},
},
{
urlPattern: ({ request }) => request.mode === "navigate",
handler: "NetworkFirst",
options: {
cacheName: "html-cache",
},
},
],
};