let path = require("path");
let HtmlWebpackPlugin = require("html-webpack-plugin");
module.exports = {
//多入口
mode: "development",
entry: {
home: './src/index.js',
other: './src/other.js'
},
output: {
//[name] home,other对应要打包的js名
filename: "[name].js",
path: path.resolve(__dirname, 'dist'),
},
plugins: [
new HtmlWebpackPlugin({
template: './index.html',
filename: 'home.html',
chunks: ['home'],//告诉每个html要加载的js名
}),
new HtmlWebpackPlugin({
template: './index.html',
filename: 'other.html',
chunks: ['other'],
})
]
}
webpack4.0多页面配置
最新推荐文章于 2022-09-26 10:02:33 发布