首先安装插件
yarn add filemanager-webpack-plugin@2.0.5 -D
const FileManagerPlugin = require('filemanager-webpack-plugin')
const myDate = new Date()
const time =
myDate.getFullYear() +
'-' +
parseInt(Number(myDate.getMonth()) + 1) +
'-' +
myDate.getDate()
module.exports = {
configureWebpack: {
//webpack的相关配置在这里
plugins: [
new FileManagerPlugin({
//初始化 filemanager-webpack-plugin 插件实例
onEnd: {
delete: [`./${time}.zip`],
archive: [
{
source: './dist',
destination: `./${time}.zip`,
},
],
},
}),
],
},
}