【问题标题】:WEBPACK 4 SplitChunksPlugin doesntsplitWEBPACK 4 SplitChunksPlugin 不拆分
【发布时间】: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 代码

标签: webpack webpack-4


【解决方案1】:

答案是提高优先级。一旦我添加了priority:100,它就起作用了

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-11-01
    • 2019-06-03
    • 2020-12-11
    • 2018-10-08
    • 2020-09-14
    相关资源
    最近更新 更多