【发布时间】:2018-08-09 11:33:18
【问题描述】:
我设置了
```
optimization:{
splitChunks:
'my-bundle1':{
chunks:"async",
test: (module)=>{
return /my-bundle1/.test(module.resource)
},
name:"my-bundle1",
enforce:true,
reuseExistingChunk:true
}}
```
但是,路径包含 my-bundle1 的文件的来源不会出现在 my-bundle1.bundle.js 中。而是出现在 common.js 中
PS:在 webpack 3 中,我曾经通过 commonsChunkPlugins 列表创建这些包:
new CommonsChunkPlugin({
"minChunks":function(module,count) {
return module.resource & /my-bundle1//.test(module.resource) && count>=2;
},
"async":"mybundle1-1.0.0"
}),
...
【问题讨论】:
-
splitChunks 属性的值将包含在 {}
-
@kryptokinght 是伪 JSON 代码