【发布时间】:2020-06-04 19:51:03
【问题描述】:
我已经安装了workbox-cli
并使用下面的配置,位于config.js
const {InjectManifest} = require('workbox-webpack-plugin');
const path = require('path');
module.exports = {
webpack: function(config, env) {
config.plugins.push(
new InjectManifest({
globPatterns: ['**/*.{js,css}'],
swSrc: path.join('public', 'custom-service-worker.js'),
swDest: 'service-worker.js',
maximumFileSizeToCacheInBytes: 5000000,
})
);
return config;
}
}
然后运行
workbox generateSW config.js
我明白了
您的配置无效:
{ "webpack": function(config, env) {\n config.plugins.push(\n new InjectManifest({\n >globPatterns: ['**/*.{js,css}'],\n swSrc: 路径.join('public', 'custom-service->worker.js'),\n swDest: 'service-worker.js',\n maximumFileSizeToCacheInBytes: >5000000,\n })\n );\n 返回配置;\n }, "swDest" [1]: -- 缺失 -- }
[1] "swDest" 是必需的
我不知道还能做什么,因为我提供的是swDest
【问题讨论】:
标签: service-worker workbox workbox-webpack-plugin