依赖包:html-webpack-plugin
const HtmlWebpackPlugin = require('html-webpack-plugin')
plugins: [
// 默认创建一个html文件,并自动引入打包输出的所有资源
// new HtmlWebpackPlugin()
new HtmlWebpackPlugin({
// 复制模板,并...
template: './src/index.html',
// 输出目录及名称
filename: 'abc/index.html',
// 压缩html
minify: {
// 移除空格
collapseWhitespace: true,
// 移除注释
removeComments: true
}
})
]