我正在使用Webpack 4.x,并在我的配置文件中添加了以下内容:
splitChunks: {
chunks: 'all',
},
runtimeChunk: true
在我的项目中,这导致了三个块:
- app.prod.js
- 1.app.prod.js
- 2.app.prod.js
是否有一种方法可以使初始的
app.prod.js
自动需要/导入其他块?我正在使用Webpack 4.x,并在我的配置文件中添加了以下内容:
splitChunks: {
chunks: 'all',
},
runtimeChunk: true
app.prod.js
自动需要/导入其他块? optimization: {
runtimeChunk: 'single',
},
entry: {
rendererA: `${basePath}/src/windowA/`,
rendererB: `${basePath}/src/windowB/`,
},
plugins: [
new HtmlWebpackPlugin({
template: path.resolve(basePath, 'src/index.html'),
chunks: ['rendererA'],
filename: 'rendererA.html',
}),
new HtmlWebpackPlugin({
template: path.resolve(basePath, 'src/index.html'),
chunks: ['rendererB'],
filename: 'rendererB.html',
}),
]