Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'disable' option not disabling pwa feature in development mode. #371

Closed
david-buck opened this issue Jul 28, 2022 · 4 comments · Fixed by #372
Closed

'disable' option not disabling pwa feature in development mode. #371

david-buck opened this issue Jul 28, 2022 · 4 comments · Fixed by #372
Labels
bug Something isn't working

Comments

@david-buck
Copy link

Summary

My next.config.mjs file has next-pwa configured like so:

export default withPWA({
  pwa: {
    dest: "public",
    register: false,
    skipWaiting: false,
    dynamicStartUrl: false,
    runtimeCaching,
    disable: process.env.NODE_ENV === "development",
  }, ...

The disable option seems to be ignored, even if set to disable: true which leads to all the quirks that come with running next-pwa in development mode.

Versions

  • next-pwa: 5.5.5
  • next: 12.2.3

How To Reproduce

Steps to reproduce the behavior:

  1. add disable: true option to next.config.js
  2. yarn dev
  3. see warnings in console:
warn  - GenerateSW has been called multiple times, perhaps due to running webpack in --watch mode. The precache manifest generated after the first call may be inaccurate! Please see https://github.com/GoogleChrome/workbox/issues/1790 for more information.
@david-buck david-buck added the bug Something isn't working label Jul 28, 2022
@phil-madpaws
Copy link

phil-madpaws commented Aug 7, 2022

Using this as a workaround for now:

module.exports = prod ? withPWA(nextConfig) : nextConfig;

@piro0919
Copy link

piro0919 commented Aug 7, 2022

I think it works fine with v5.5.4.
I'm sorry, but I haven't investigated the cause yet.
I think maybe the flag handling is reversed.

@ymchun
Copy link

ymchun commented Aug 9, 2022

seems related to this line:

delete pwaNextConfig.pwa

.pwa config is deleted too early so that webpack function can't read any user config.

} = pwa

the value of pwa variable is {}

@faisalamin001
Copy link

Using this as a workaround for now:

module.exports = prod ? withPWA(nextConfig) : nextConfig;

it worked for me as well, thanks!
@phil-madpaws

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants