我正在努力遵循有关隐式通用供应商块的文档。
我希望所有人都node_modules
在供应商块中。我有一个入口点 ( app
),有几个子块。我试过了:
new webpack.optimize.CommonsChunkPlugin({
name: 'vendors',
minChunks: module => module.context && module.context.includes('node_modules'),
}),
-> 从入口块 (app.chunk.js) 中删除所有 node_modules,但将 node_modules 留在子项中
new webpack.optimize.CommonsChunkPlugin({
name: 'app',
async: 'vendors',
children: true,
minChunks: module => module.context && module.context.includes('node_modules'),
}),
-> 从所有子块中删除 node_modules 但不是从应用程序...
寻找一种方法来做到这两点(从所有块中剥离 node_modules 并将它们放在 vendor.chunk.js 中)。
提前致谢,