shadowwalker / next-pwa

Zero config PWA plugin for Next.js, with workbox 🧰
MIT License
3.87k stars 324 forks source link

'customWorkerDir' property is not expected to be here #292

Open stopyransky opened 2 years ago

stopyransky commented 2 years ago

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?

shadowwalker commented 2 years ago

Should be fixed with latest version right?

akramshekh-me commented 2 years ago

No, I was facing same issues.

jaywhen commented 2 years ago

hey, the readme has been updated, you can write like this:

const withPWA = require('next-pwa')({
  customWorkerDir: 'serviceworker'
  ...
})

module.exports = withPWA({
  // next.js config
})