vite.config.ts 660 B

123456789101112131415161718192021222324252627282930
  1. import { defineConfig, loadEnv } from "vite";
  2. import react from "@vitejs/plugin-react";
  3. import path from "path";
  4. export default defineConfig(({ mode }) => {
  5. const env = loadEnv(mode, process.cwd(), "");
  6. const apiTarget = env.VITE_API_BASE_URL || "http://127.0.0.1:8100";
  7. return {
  8. plugins: [react()],
  9. resolve: {
  10. alias: {
  11. "@": path.resolve(__dirname, "./src"),
  12. },
  13. },
  14. server: {
  15. port: 5173,
  16. proxy: {
  17. "/gateway": {
  18. target: apiTarget,
  19. changeOrigin: true,
  20. },
  21. "/health": {
  22. target: apiTarget,
  23. changeOrigin: true,
  24. },
  25. },
  26. },
  27. };
  28. });