This commit is contained in:
2026-02-02 16:34:10 +08:00
parent c0e2d47287
commit 544de32d80
13 changed files with 733 additions and 31 deletions

View File

@@ -4,6 +4,17 @@ import path from "path"
import tailwindcss from "@tailwindcss/vite"
// https://vite.dev/config/
export default defineConfig({
server: {
proxy: {
// 1. 匹配所有以 /api 开头的请求
'/api': {
target: 'http://localhost', // 你的 Java 后端地址
changeOrigin: true, // 允许跨域
// 2. 路径重写:如果后端接口没有 /api 前缀,就把它删掉
rewrite: (path) => path.replace(/^\/api/, '')
},
}
},
plugins: [
tailwindcss(),
react({