const { defineConfig } = require("@vue/cli-service");
const FileManagerPlugin = require("filemanager-webpack-plugin"); // 压缩文件夹
const isDev = process.env.NODE_ENV === "development";
let plugins = [];
// 避免打本地启项目时自动打zip包
if (!isDev) {
  plugins.push(
    new FileManagerPlugin({
      events: {
        onEnd: {
          // mkdir: ["./dist"],
          delete: ["./zip/"],
          copy: [{ source: "./dist", destination: "./zip/dist" }],
          archive: [{ source: "./zip", destination: "./zip/样表管理系统.zip" }],
        },
      },
    })
  );
}
module.exports = defineConfig({
  transpileDependencies: true,
  productionSourceMap: false,
  // webpack 插件
  configureWebpack: {
    plugins: [...plugins],
  },
  transpileDependencies: true,
  // 打包输出目录
  outputDir: "dist",
  publicPath: "./",
});
