html插件 (npm install html-webpack-plugin —save-dev)
const HtmlWebpackPlugin = require('html-webpack-plugin')module.exports = {plugins: [new HtmlWebpackPlugin({title: 'my-webpack',path: '/dist',template: "./public/index.html",// 压缩minify: {// 移除空格collapseWhitespace: true,// 移除注释removeCommnents: true}})]}
- title 打包的html的title
- filename 名称
- path 路径 __dirname + ‘/dist’
- template 使用指定路径的html作为模板
