next-pwa
next-pwa copied to clipboard
'customWorkerDir' property is not expected to be here
Hey, i. tried to follow this example
and received following error:
error - Please check your GenerateSW plugin configuration:
[WebpackGenerateSW] 'customWorkerDir' property is not expected to be here. Did you mean property 'sourcemap'?
PWA config in next.config.js:
{
pwa: {
dest: 'public',
customWorkerDir: 'worker',
},
},
> [PWA] Compile client (static)
> [PWA] Custom worker found: /worker/index.js
> [PWA] Build custom worker: /public/worker-development.js
> [PWA] Auto register service worker with: /node_modules/next-pwa/register.js
> [PWA] Service worker: /public/sw.js
> [PWA] url: /sw.js
> [PWA] scope: /
> [PWA] Build in develop mode, cache and precache are mostly disabled. This means offline support is disabled, but you can continue developing other functions in service worker.
> [PWA] Compile server
versions: "next": "12.0.2" "next-pwa": "5.3.1"
What am i doing wrong here?
Should be fixed with latest version right?
No, I was facing same issues.
hey, the readme has been updated, you can write like this:
const withPWA = require('next-pwa')({
customWorkerDir: 'serviceworker'
...
})
module.exports = withPWA({
// next.js config
})