1.npm install--save-dev clean-webpack-plugin
const CleanWebpackPlugin=require('clean-webpack-plugin');
const path=require('path');
module.exports={
entry:'index.js',
output:{
path:path.resolve(__dirname,'./dist'),
filename:'index_bundle.js'
},
plugins: [
new CleanWebpackPlugin(['dist'])//自动删除打包之前的dist文件目录
]
};
网友评论