//多入口
entry: {
home: './src/home',
other: './src/other'
},
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: 'other.html',
chunks: ['other']
}),
]
使用[name]
表示动态的名字
output对象如果需要每次打包产生新的文件,并且指定生成8位hash码,可以这样写
[name].[:8].js