文件夹结构:

app.js、benchmark.js、board.js都需要jquery。我只想提取jquery,因为vender.js和其他三个包只包含应用程序代码:
Webpack:

结果并不如我所料:
app.js、benchmark.js、board.js仍然包含jquery代码(从巨大的文件大小可以看出)

我的webpack配置有什么问题吗?我只是遵循了以下例子:https://github.com/webpack/webpack/tree/master/examples/two-explicit-vendor-chunks https://github.com/webpack/webpack/tree/master/examples/multiple-entry-points
发布于 2015-10-06 19:52:34
plugins应该是modules之外的对象数组。
另外,我认为对于这个用例场景,您不需要minChunks或块选项。您的供应商输入块应该足够了。
entry: {
vendor: ['jquery']
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({
name: "vendor",
filename:"vendor.js",
minChunks: Infinity
})
];https://stackoverflow.com/questions/32813138
复制相似问题