Next-pwa: __WB_DISABLE_DEV_LOGS not working

Created on 22 Mar 2021  路  8Comments  路  Source: shadowwalker/next-pwa

Summary

I want to disable the workbox log in development mode.
Even putting it as true, it still keeps showing up.

How To Reproduce

Steps to reproduce the behavior:

  1. Create folder "worker"
  2. Create file "index.js"
  3. Add "self.__WB_DISABLE_DEV_LOGS = true;"

Expected Behaviors

I need the debug to be removed by adding true to __WB_DISABLE_DEV_LOGS

Screenshots

Screenshot_6

bug fixed

Most helpful comment

I could reproduce this error. But it works perfectly after I clean everything up and rebuild under development mode. I think you can fix this too.

  1. Exit development process if you are still running yarn dev or next
  2. Create custom worker worker/index.js or worker/index.ts and add self.__WB_DISABLE_DEV_LOGS = true on the top of the file.
  3. Remove .next folder
  4. Run yarn dev
  5. Open browser and navigate to your app and under Application tab in development tools, click 'Clear site data', then right click the refresh button and click 'Empty Cache and Hard Reload'
  6. Everything should work as expected now, workbox does not produce logs to your console now.

image

@EpicHigh tips for your pwa config, you should update your config to this: (minimal is enough)

pwa: {
  dest: 'public'
}

All 8 comments

Use disable for development

module.exports = withPWA({
    future: {
        webpack5: true
    },
    pwa: {
        disable: process.env.NODE_ENV === 'development',
        dest: 'public'
    }
})

Can you first try next-pwa 5.1.3?

I am encountering this issue too. I am using next-pwa 5.1.3.

Try another way, set in your pwa config: mode: 'production'

Thank you for your response. It's not working.

Here's my PWA config.

pwa: {
          disable: process.env.NODE_ENV === 'development',
          register: true,
          dest: 'public',
          runtimeCaching,
          mode: 'production'
        }

I could reproduce this error. But it works perfectly after I clean everything up and rebuild under development mode. I think you can fix this too.

  1. Exit development process if you are still running yarn dev or next
  2. Create custom worker worker/index.js or worker/index.ts and add self.__WB_DISABLE_DEV_LOGS = true on the top of the file.
  3. Remove .next folder
  4. Run yarn dev
  5. Open browser and navigate to your app and under Application tab in development tools, click 'Clear site data', then right click the refresh button and click 'Empty Cache and Hard Reload'
  6. Everything should work as expected now, workbox does not produce logs to your console now.

image

@EpicHigh tips for your pwa config, you should update your config to this: (minimal is enough)

pwa: {
  dest: 'public'
}

Wow, I appreciate that. Thank you for your help. It's work as expected.

@shadowwalker Thanks :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

loyep picture loyep  路  3Comments

vishwasnavadak picture vishwasnavadak  路  8Comments

marcofranssen picture marcofranssen  路  5Comments

jonahsnider picture jonahsnider  路  4Comments

LucasMallmann picture LucasMallmann  路  4Comments