目标
yarn build:prod后生成的dist资源文件夹,自动打包成dist.zip压缩包
安装插件
filemanager-webpack-plugin@6.1.5: The engine "node" is incompatible with this module. Expected version "^12.20.0 || ^14.13.1 || >=16.0.0".
yarn add filemanager-webpack-plugin -D
npm i filemanager-webpack-plugin -D
cnpm i filemanager-webpack-plugin -D
配置使用
vue.config.js
const FileManagerPlugin = require('filemanager-webpack-plugin');
module.exports = {
configureWebpack: config => {
config.plugins.push(
new FileManagerPlugin(
{
events: {
onEnd: {
delete: ['./dist.zip'],
archive: [{
source: path.join(__dirname, './dist'),
destination: path.join(__dirname, './dist.zip')
}]
}
}
}
)
)
},
}