import { defineConfig } from "@farmfe/core";
import vue from "@vitejs/plugin-vue";
import vueJsx from "@vitejs/plugin-vue-jsx";
import qiankun from "vite-plugin-qiankun";
import path from "path";
import less from "@farmfe/js-plugin-less";
import Components from "unplugin-vue-components/vite";
import { AntDesignVueResolver } from "unplugin-vue-components/resolvers";

// const ENVS = {
//   DEVELOPMENT: "development",
//   PRODUCTION: "production",
//   STAGING: "staging",
//   TEST: "test",
// };

// const env = process.env.NODE_ENV;

export default defineConfig({
  plugins: [less()],
  vitePlugins: [
    vue(),
    vueJsx(),
    qiankun("y-code-app", {
      useDevMode: process.env.DEV_ENV === "development",
    }) as any,
    Components({
      resolvers: [
        AntDesignVueResolver({
          importStyle: "less",
        }),
      ],
    }),
  ],
  server: {
    cors: true,
    port: 10012,
  },
  compilation: {
    resolve: {
      alias: {
        "@": path.resolve(__dirname, "./src"),
      },
    },
  },
});
