Open thedevdavid opened 4 years ago
Same here I can see the service-worker.js file created however its not been served when using express setup and results in 404 error
@DLevai94, @Quadriphobs1
I had same issue, but got this working with the following config:
Note how I'm telling workbox to put the generated service-worker.js into ../public/
This way when the app is built next serves it at /service-worker.js
const withOffline = require('next-offline')
const config = {
workboxOpts: {
swDest: '../public/service-worker.js',
},
// rest of your config
}
module.exports = withOffline(config)
Hey! I've configured next-offline with next-componse plugins & now 2 with the following setup:
Devtools shows it's generates multiple but I can't see it from Source
The error:
SW registration failed: TypeError: Failed to register a ServiceWorker for scope ('http://localhost:3000/') with script ('http://localhost:3000/service-worker.js'): A bad HTTP response code (404) was received when fetching the script.
It runs on the latest Next (9.3) and latest next-offline (5.0)
Link: https://web.qa.unipieapp.com