问题描述
我正在使用workBox-webpack-plugin @ v5并尝试过:
event1
然后在event2
中将webpackCompilationPlugins: [
new webpack.optimize.SplitChunksPlugin({
cacheGroups: {
workBox: {
test: /[\\/]node_modules[\\/]workBox-.*/,filename: '[name]-[contenthash:8].js',name: 'workBox',chunks: 'all',enforce: true
}
}
}),// https://github.com/GoogleChrome/workBox/issues/2399
new webpack.webworker.WebWorkerTemplatePlugin()
]
设置为output.globalObject
但是该块未导入到Service Worker中。错误:
'self'
目标
得到一个小的inject-manifest.js
和Cannot read property 'call' of undefined
at r (service-worker.js:1)
...
,然后工作。
其他信息
似乎与https://github.com/webpack/webpack/issues/7879
有关workBox-webpack-plugin GenerateSW模式以汇总方式做到了。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)