-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsw.js
32 lines (30 loc) · 749 Bytes
/
sw.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
importScripts(
"https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js"
);
workbox.core.setCacheNameDetails({
prefix: "datum",
suffix: "v1.0.0"
});
workbox.routing.registerRoute("/", new workbox.strategies.CacheFirst());
workbox.routing.registerRoute(
"/js-modules-experiment",
new workbox.strategies.CacheFirst()
);
workbox.routing.registerRoute(
"/js-modules-experiment/",
new workbox.strategies.CacheFirst()
);
workbox.routing.registerRoute(
/\.(?:mjs|css|html)$/,
new workbox.strategies.CacheFirst()
);
workbox.routing.registerRoute(
/^https:\/\/unpkg.com/,
new workbox.strategies.CacheFirst({
plugins: [
new workbox.cacheableResponse.Plugin({
statuses: [0, 200]
})
]
})
);