webpack关于通过html-webpack-plugin插件使用同一个模版template生成多个文件
plugins:[
new htmlWebpackPlugin({
template:'index.html',
filename:'index.a.html',
inject:false,
title:'webpack title a',
body:'a body',
excludeChunks:['b','c']
minify:{
removeComments:true, //去除注释
collapseWhitespace:true //去除空格
}
})
用一个模版生成一个index.a.html文件,没问题,但是用同一个模版生成index.a.html,index.b.html,index.c.html就会报错,视频里老师也没错啊,而且报错有点莫名其妙,有和我一样的么?
用两个不同的模版生成两个文件也没问题
plugins:[
new htmlWebpackPlugin({
template:'index.html',
filename:'index.a.html',
inject:false,
title:'webpack title a',
body:'a body',
excludeChunks:['b','c']
minify:{
removeComments:true, //去除注释
collapseWhitespace:true //去除空格
}
}),
new htmlWebpackPlugin({
template:'index.html',
filename:'index.b.html',
inject:false,
title:'webpack title b',
body:'b body',
chunks:['main','b']
}),
new htmlWebpackPlugin({
template:'index.html',
filename:'index.c.html',
inject:false,
title:'webpack title c',
body:'c body',
chunks:['main','c']
})
]