Workbox-powered service worker! code example
Example: workbox
const path = require('path');
module.exports = {
swDest: path.resolve(process.cwd(), 'src/serviceWorker.js'),
globDirectory: process.cwd(),
globPatterns: ['**/*.{js, css, html}'],
globIgnores: [
'node_modules/**/*',
'**/gsw-wb.config.js',
'**/gij-wb.config.js'
],
runtimeCaching: [{
method: 'GET',
urlPattern: /\.(?:png|jpe?g|gif|svg)$/,
handler: "CacheFirst",
options: {
cacheName: "images-assets",
cacheableResponse: {
statuses: [0, 200]
},
expiration: {
maxEntries: 100,
maxAgeSeconds: 24 * 60 * 60 * 7
},
}
}],
clientsClaim: true,
skipWaiting: true,
cleanupOutdatedCaches: true,
maximumFileSizeToCacheInBytes: 1572864
}