假设有两个入口文件home.js和other.js需要打包
let path = require('path);
let HtmlWebpackPlugin = require('html-webpack-plugin);
module.exports = {
mode: 'development',
entry: {
home: './src/index.js',
other: './src/other.js'
},
output: {
filename: '[name].js',
path: path.resolve( __dirname, 'dist' )
},
plugins: [
new HtmlWebpackPlugin ({
template: './index.html',
filename: 'home.html',
chunks: ['home']
}),
new HtmlWebpackPlugin ({
template: './index.html',
filename: 'home.html',
chunks: ['other']
})
]
}
网友评论