chore(dev): 清理 vite.config 无效代理配置

- 移除 /api /file /media /upload → :10801 代理(前端已走 API_BASE 直连 Python 后端 :10085)
- defineConfig 由 async 简化为同步
This commit is contained in:
Pine
2026-08-18 01:41:40 +08:00
parent 7a82a94057
commit 4e8ae4024a
+4 -10
View File
@@ -3,7 +3,7 @@ import react from "@vitejs/plugin-react";
import tailwindcss from "@tailwindcss/vite"; import tailwindcss from "@tailwindcss/vite";
// https://vite.dev/config/ // https://vite.dev/config/
export default defineConfig(async () => ({ export default defineConfig({
plugins: [react(), tailwindcss()], plugins: [react(), tailwindcss()],
clearScreen: false, clearScreen: false,
@@ -13,15 +13,9 @@ export default defineConfig(async () => ({
// 监听所有网络接口,局域网内其他设备可通过 http://<IP>:1420 访问 // 监听所有网络接口,局域网内其他设备可通过 http://<IP>:1420 访问
host: true, host: true,
watch: { watch: {
// 忽略 src-tauri 与后端 venvultralytics/matplotlib 的 html 会误触发页面 reload // 忽略 src-tauri 与后端 venv/vendorultralytics/matplotlib 的 html 会误触发页面 reload
ignored: ["**/src-tauri/**", "**/backend/.venv/**", "**/backend/vendor/**"], ignored: ["**/src-tauri/**", "**/backend/.venv/**", "**/backend/vendor/**"],
}, },
// 开发时代理 API 请求到 Rust 后端 // 注:API 走 src/config.js 的 API_BASEPython 后端 :10085)直连,不再需要 dev 代理
proxy: {
'/api': 'http://localhost:10801',
'/file': 'http://localhost:10801',
'/media': 'http://localhost:10801',
'/upload': 'http://localhost:10801',
},
}, },
})); });