const path = require('path');const HTMLWebpackPlugin = require('html-webpack-plugin');module.exports = {entry: {index: './src/index.js',another: './src/another-module.js'},plugins: [new HTMLWebpackPlugin({title: 'Code Splitting'})],output: {filename: '[name].bundle.js',path: path.resolve(__dirname, 'dist')}};
entry的配置,产生chunk.
这种方法存在一些问题:
- 如果入口 chunks 之间包含重复的模块,那些重复模块都会被引入到各个 bundle 中。
- 这种方法不够灵活,并且不能将核心应用程序逻辑进行动态拆分代码。
