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"],
          archive: [{ source: "./dist", destination: "./样表终端系统.zip" }],
        },
      },
    })
  );
}
module.exports = defineConfig({
  transpileDependencies: true,
  productionSourceMap: false,
  lintOnSave: false,
  // 打包输出目录
  outputDir: "dist",
  publicPath: "./",
  // webpack 插件
  configureWebpack: {
    plugins: [...plugins],
  },
  transpileDependencies: true,
  devServer: {
    port: 9086,
    hot: "only", //自动保存
    proxy: {
      "/sampleform": {
        target: "http://localhost:17002",
        changeOrigin: true,
        secure: false,
        cookieDomainRewrite: "localhost",
      },
    },
  },
});
