javascriptwebprogressive-web-appsworkbox

How to enable debug mode by generating service worker file from workbox cli?


I'm trying to enable my workbox config to debug mode

Usually I just have to set the config in my sw.js file like this

workbox.setConfig({
  debug: true,
});

But because now I'm using generateSW form workbox-cli, I can't set the debug to true

I've tried to configure my workbox-config.js file like this

module.exports = {
  "globDirectory": "./",
  "globPatterns": [
    "**/*.{css,ico,png,html,js,json}"
  ],
  "swDest": "sw.js",
  "debug",true
};

But it doesn't work


Solution

  • If you're using Workbox v5 or later, you'd set the mode: 'development' option.

    You can view the full list of options in the documentation.