import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import ViteComponents from "unplugin-vue-components/vite";
import { AntDesignVueResolver } from "unplugin-vue-components/resolvers";

// const SERVER_URL = "http://192.168.10.108:7180";
// const SERVER_URL = "http://192.168.10.138:13800";
const SERVER_URL = "http://192.168.10.39:7180";
// const SERVER_URL = "http://192.168.10.54:8001";
const path = require("path");

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue({
      reactivityTransform: true,
    }),
    ViteComponents({
      resolvers: [AntDesignVueResolver()],
      dts: true,
    }),
  ],
  server: {
    port: 9000,
    // strictPort: true,
    fs: {
      strict: true,
      allow: ["./"],
    },
    proxy: {
      "/api": {
        target: SERVER_URL,
        changeOrigin: true,
      },
    },
  },
  resolve: {
    alias: [{ find: "@", replacement: path.resolve(__dirname, "./src") }],
    extensions: [".js", ".mjs", ".ts", ".vue", ".json", ".scss", ".css"],
  },
  build: {
    ssr: false,
  },
  // define: {
  //   __VUE_PROD_DEVTOOLS__: true, // no effect
  // },
});
