2019-10-10 12:05:29 +02:00
|
|
|
const withOffline = require('next-offline')
|
|
|
|
|
2019-11-27 03:03:09 +01:00
|
|
|
module.exports = withOffline({
|
|
|
|
workboxOpts: {
|
2019-12-31 16:15:06 +01:00
|
|
|
swDest: process.env.NEXT_EXPORT
|
|
|
|
? 'service-worker.js'
|
|
|
|
: 'static/service-worker.js',
|
2020-01-02 17:50:27 +01:00
|
|
|
runtimeCaching: [
|
|
|
|
{
|
|
|
|
urlPattern: /^https?.*/,
|
|
|
|
handler: 'NetworkFirst',
|
|
|
|
options: {
|
|
|
|
cacheName: 'offlineCache',
|
|
|
|
expiration: {
|
|
|
|
maxEntries: 200,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
2019-11-27 03:03:09 +01:00
|
|
|
},
|
2020-06-27 11:18:18 +02:00
|
|
|
async rewrites() {
|
|
|
|
return [
|
|
|
|
{
|
|
|
|
source: '/service-worker.js',
|
|
|
|
destination: '/_next/static/service-worker.js',
|
|
|
|
},
|
|
|
|
]
|
2019-11-27 03:03:09 +01:00
|
|
|
},
|
|
|
|
})
|