star-international-ui/vite.config.js
aifeilong 00d5558fe2 Align frontend API calls with app-prefixed backend routes.
Update service URLs and the Vite proxy rewrite so requests match /content/, /cms/, and /common/ mounts after /api is stripped.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-15 08:42:37 +08:00

30 lines
692 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import path from "path";
// https://vite.dev/config/
export default defineConfig({
plugins: [react()],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
server: {
open: "/",
host: "0.0.0.0", //wsl中使用
proxy: {
// 前端仍请求 /api/*,转发到 Django 时剥掉 /api(与线上网关一致)
"/api": {
target: "http://127.0.0.1:8000",
changeOrigin: true,
rewrite: (p) => p.replace(/^\/api/, ""),
},
"/media": {
target: "http://127.0.0.1:8000",
changeOrigin: true,
},
},
},
});