目标

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".

windows更新Node版本

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')
              }]
            }
          }
        }
      )
    )
  },
}

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐