多入口首先需要在入口entry中配置多个入口文件
entry: {// 这里入口就有两个chunk, index和otherindex: path.join(srcPath, 'index.js'),other: path.join(srcPath, 'index.js')}
接着要修改htmlwebpackplugin的配置,要生成多个html
plugins: [new HtmlWebpackPlugin({template: path.join(srcPath, 'index.html'),filename: 'index.html',// chunks 表示该页面要引用哪些 chunk (即上面的index和other)chunks: ['index'] // 只引入index}),new HtmlWebpackPlugin({template: path.join(srcPath, 'other.html'),filename: 'other.html',chunks: ['other'] // 只引入other})]
