vite.config.ts 986 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import { resolve } from "path";
  2. import { defineConfig } from "vite";
  3. import react from "@vitejs/plugin-react-swc";
  4. let devProxyServer = "http://localhost:8081/";
  5. if (process.env.DEV_PROXY_SERVER && process.env.DEV_PROXY_SERVER.length > 0) {
  6. console.log("Use devProxyServer from environment: ", process.env.DEV_PROXY_SERVER);
  7. devProxyServer = process.env.DEV_PROXY_SERVER;
  8. }
  9. // https://vitejs.dev/config/
  10. export default defineConfig({
  11. plugins: [react()],
  12. server: {
  13. host: "0.0.0.0",
  14. port: 3001,
  15. proxy: {
  16. "^/api": {
  17. target: devProxyServer,
  18. changeOrigin: true,
  19. },
  20. "^/o/": {
  21. target: devProxyServer,
  22. changeOrigin: true,
  23. },
  24. "^/u/.+/rss.xml": {
  25. target: devProxyServer,
  26. changeOrigin: true,
  27. },
  28. "/explore/rss.xml": {
  29. target: devProxyServer,
  30. changeOrigin: true,
  31. },
  32. },
  33. },
  34. resolve: {
  35. alias: {
  36. "@/": `${resolve(__dirname, "src")}/`,
  37. },
  38. },
  39. });