From 4e8ae4024adb3ee0cb789716e8cd54bd94d10f06 Mon Sep 17 00:00:00 2001 From: Pine Date: Tue, 18 Aug 2026 01:41:40 +0800 Subject: [PATCH] =?UTF-8?q?chore(dev):=20=E6=B8=85=E7=90=86=20vite.config?= =?UTF-8?q?=20=E6=97=A0=E6=95=88=E4=BB=A3=E7=90=86=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除 /api /file /media /upload → :10801 代理(前端已走 API_BASE 直连 Python 后端 :10085) - defineConfig 由 async 简化为同步 --- vite.config.js | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/vite.config.js b/vite.config.js index f35a905..1eb1d9b 100644 --- a/vite.config.js +++ b/vite.config.js @@ -3,7 +3,7 @@ import react from "@vitejs/plugin-react"; import tailwindcss from "@tailwindcss/vite"; // https://vite.dev/config/ -export default defineConfig(async () => ({ +export default defineConfig({ plugins: [react(), tailwindcss()], clearScreen: false, @@ -13,15 +13,9 @@ export default defineConfig(async () => ({ // 监听所有网络接口,局域网内其他设备可通过 http://:1420 访问 host: true, watch: { - // 忽略 src-tauri 与后端 venv(ultralytics/matplotlib 的 html 会误触发页面 reload) + // 忽略 src-tauri 与后端 venv/vendor(ultralytics/matplotlib 的 html 会误触发页面 reload) ignored: ["**/src-tauri/**", "**/backend/.venv/**", "**/backend/vendor/**"], }, - // 开发时代理 API 请求到 Rust 后端 - proxy: { - '/api': 'http://localhost:10801', - '/file': 'http://localhost:10801', - '/media': 'http://localhost:10801', - '/upload': 'http://localhost:10801', - }, + // 注:API 走 src/config.js 的 API_BASE(Python 后端 :10085)直连,不再需要 dev 代理 }, -})); +});