rsnext/examples/with-next-offline/next.config.js
2020-01-02 11:50:27 -05:00

31 lines
641 B
JavaScript

const withOffline = require('next-offline')
module.exports = withOffline({
workboxOpts: {
swDest: process.env.NEXT_EXPORT
? 'service-worker.js'
: 'static/service-worker.js',
runtimeCaching: [
{
urlPattern: /^https?.*/,
handler: 'NetworkFirst',
options: {
cacheName: 'offlineCache',
expiration: {
maxEntries: 200,
},
},
},
],
},
experimental: {
async rewrites() {
return [
{
source: '/service-worker.js',
destination: '/_next/static/service-worker.js',
},
]
},
},
})