import { defineConfig, loadEnv } from "vite";
import vue from "@vitejs/plugin-vue";
import { resolve } from "path";

// 所有环境统一使用根路径部署
const base = "/";

// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
  return {
    base,
    plugins: [vue()],
    resolve: {
      alias: {
        "@": resolve(__dirname, "src"),
      },
    },
    server: {
      host: "0.0.0.0",
      port: 3000,
      proxy: {
        // 主后端
        "/api": {
          target: "http://localhost:8580",
          changeOrigin: true,
        },
      },
    },
  };
});
