netlify-cms-react-starter/sw-precache-config.js
2017-07-05 21:07:57 +10:00

23 lines
574 B
JavaScript

// we overwrite the default service worker config to enable runtimeCaching
module.exports = {
stripPrefix: 'build/',
staticFileGlobs: [
'build/**/*.html',
'build/*.svg',
'build/*.jpg',
'build/*.png',
'build/*.ico',
'build/*.json',
'build/static/**/!(*map*)',
'build/manifest.json'
],
dontCacheBustUrlsMatching: /\.\w{8}\./,
swFilePath: 'build/service-worker.js',
// any external urls you wish to cache (e.g. CDN)
runtimeCaching: [
{
urlPattern: /^https?:\/\/.*example-cdn.com/,
handler: 'cacheFirst'
}
]
}