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

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

我正在尝试将我的工作箱配置启用为调试模式

通常我只需要像这样在 sw.js 文件中设置配置

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

但是因为现在我正在使用 generateSW form workbox-cli,所以我无法将调试设置为 true

我试过像这样配置我的工作箱-config.js文件

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

但是不行

如果您使用的是 Workbox v5 或更高版本,则需要设置 mode: 'development' 选项。

您可以在 the documentation 中查看完整的选项列表。