vite.config.ts 726 B

123456789101112131415161718192021222324252627282930313233
  1. import react from "@vitejs/plugin-react";
  2. import { defineConfig } from "vite";
  3. import { nodePolyfills } from "vite-plugin-node-polyfills";
  4. export default defineConfig(({ mode }) => ({
  5. plugins: [react(), nodePolyfills()],
  6. resolve: {
  7. alias: {
  8. assets: "/src/assets",
  9. components: "/src/components",
  10. legacy: "/src/legacy",
  11. lib: "/src/lib",
  12. main: "/src/main",
  13. shared: "/src/shared",
  14. utils: "/src/utils",
  15. },
  16. },
  17. build: {
  18. outDir: "build",
  19. },
  20. server: {
  21. port: 8081,
  22. proxy: {
  23. ...(mode === "development" && {
  24. "/api": {
  25. target: "http://localhost:8080",
  26. changeOrigin: true,
  27. ws: true,
  28. },
  29. }),
  30. },
  31. },
  32. }));