前言
每次都要手动打zip包,很烦,所有就直接用插件了,不过要注意版本哦,不然会失败的
filemanager-webpack-plugin
: filemanager-webpack-plugin
步骤
安装插件
代码语言:javascript复制npm install filemanager-webpack-plugin@1.0.0 --save-dev
配置插件
代码语言:javascript复制const FileManagerWebpackPlugin = require('filemanager-webpack-plugin')
module.exports = {
plugins: [
new FileManagerWebpackPlugin ({
onEnd: {
mkdir: ['./dist'],
delete: [
'./dist.zip',
],
archive: [
{source: './dist', destination: './dist.zip'},
]
}
})
],
}
效果
代码语言:javascript复制npm run build