1.生产一个html文件
cnpm i html-webpack-plugin -S//自动生成index.html文件
...+const HtmlWebpackPlugin = require('html-webpack-plugin');const config = { ....+ plugins:[+ new HtmlWebpackPlugin({+ title:"webpack-vue", template:path.resolve(__dirname,"public/index.html")+ }) + ], mode:'development' //模式}module.exports = config;
2.清除dist文件夹
cnpm i clean-webpack-plugin -S//清除dist目录下需要的文件
+ const {CleanWebpackPlugin} = require("clean-webpack-plugin");const config = { ... plugins:[ ...+ new CleanWebpackPlugin() ], mode:'development' //模式}