-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathswbuilder.js
More file actions
24 lines (22 loc) · 730 Bytes
/
swbuilder.js
File metadata and controls
24 lines (22 loc) · 730 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
// adapted from https://github.com/varkor/quiver/blob/master/service-worker/build.js
const { generateSW } = require("workbox-build");
generateSW({
globDirectory: ".",
globPatterns: ["index.html", "js/*.js", "katex/*", "fonts/*"],
// so that it does not generate some additional workbox-*.js
inlineWorkboxRuntime: true,
swDest: "service-worker.js",
sourcemap: false,
skipWaiting: true,
clientsClaim: true
}).then(({ count, size, warnings }) => {
if (warnings.length > 0) {
console.warn(
"Warnings encountered while generating a service worker:",
warnings.join("\n")
);
}
console.log(
`Generated a service worker, which will precache ${count} files, totalling ${size} bytes.`
);
});