webpack 配置多入口,多目录、多文件输出
1、webpack.config.js文件中,入口节点配置:
1 entry: { 2 'index':'./src/index.js', 3 'admin/index':'./src/admin/index.js' 4 },
2、使用插件: html-webpack-plugin、配置输出文件
1 plugins:[ 2 //new CleanWebpackPlugin(['dist']), 3 new VueLoaderPlugin(), 4 new HtmlWebpackPlugin({ 5 title: 'Output Management', 6 template:'index.html', 7 chunks:['index'], 8 }), 9 10 new HtmlWebpackPlugin({ 11 title: 'Admin Management', 12 template:'index.html', 13 chunks:['admin/index'], 14 filename:'admin/index.html' 15 }), 16 //new webpack.NamedModulesPlugin(), 17 //new webpack.HotModuleReplacementPlugin() 18 ]
3、输出目录即为:


浙公网安备 33010602011771号