Skip to content

Instantly share code, notes, and snippets.

@davidgilbertson
Created December 24, 2016 01:11
Show Gist options
  • Save davidgilbertson/26014501509d9c400da7767effd05e74 to your computer and use it in GitHub Desktop.
Save davidgilbertson/26014501509d9c400da7767effd05e74 to your computer and use it in GitHub Desktop.
swPrecache.write(path.resolve(__dirname, `../public/service-worker.js`), {
cacheId: `know-it-all`,
filename: `service-worker.js`,
stripPrefix: `public/`,
staticFileGlobs: [
`public/app.*.js`, // don't include the polyfills version
`public/*.{html,ico,json,png}`,
],
dontCacheBustUrlsMatching: [
/\.(js|json)$/, // I'm cache busting js and json files myself
],
skipWaiting: true,
}, (err) => {
if (err) {
reject(err);
} else {
resolve();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment