VUE——自动打包并生成dist.zip压缩包

2024-08-16 14:00:10 浏览数 (3)

前言

每次都要手动打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

0 人点赞