-
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathworkbox-config.js
More file actions
29 lines (28 loc) · 784 Bytes
/
workbox-config.js
File metadata and controls
29 lines (28 loc) · 784 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
module.exports = {
globDirectory: "public/",
globPatterns: ["**/*.{html,css,js}"],
swDest: "public/service-worker.js",
runtimeCaching: [
{
urlPattern: /^https:\/\/fonts\.googleapis\.com/,
handler: "StaleWhileRevalidate",
options: {
cacheName: "google-fonts-stylesheets",
},
},
{
urlPattern: /^https:\/\/fonts\.gstatic\.com/,
handler: "CacheFirst",
options: {
cacheName: "google-fonts-webfonts",
expiration: {
// cache fonts for 7 days
maxAgeSeconds: 60 * 60 * 24 * 7,
maxEntries: 30,
},
},
},
],
};
// "handler" must be one of [CacheFirst, CacheOnly, NetworkFirst, NetworkOnly, StaleWhileRevalidate]
// https://www.youtube.com/watch?v=U5S6XRqT6Ow