简体   繁体   English

如何通过从工作箱 cli 生成服务工作人员文件来启用调试模式?

[英]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通常我只需要像这样在我的 sw.js 文件中设置配置

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

But because now I'm using generateSW form workbox-cli, I can't set the debug to true但是因为现在我正在使用 generateSW form workbox-cli,所以我无法将调试设置为 true

I've tried to configure my workbox-config.js file like this我试图像这样配置我的 workbox-config.js 文件

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

But it doesn't work但它不起作用

If you're using Workbox v5 or later, you'd set the mode: 'development' option.如果您使用 Workbox v5 或更高版本,您需要设置mode: 'development'选项。

You can view the full list of options in the documentation .您可以在文档中查看完整的选项列表。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM