- 端口修复

This commit is contained in:
Pine
2026-05-13 00:18:13 +08:00
parent 7794012299
commit 2bd68815fd
5 changed files with 15 additions and 19 deletions
+7 -11
View File
@@ -1,8 +1,6 @@
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
const host = process.env.TAURI_DEV_HOST;
// https://vite.dev/config/
export default defineConfig(async () => ({
plugins: [react()],
@@ -11,19 +9,17 @@ export default defineConfig(async () => ({
server: {
port: 1420,
strictPort: true,
host: host || "127.0.0.1",
hmr: host
? { protocol: "ws", host, port: 1421 }
: undefined,
// 监听所有网络接口,局域网内其他设备可通过 http://<IP>:1420 访问
host: true,
watch: {
ignored: ["**/src-tauri/**"],
},
// 开发时代理 API 请求到 Python/Rust 后端
// 开发时代理 API 请求到 Rust 后端
proxy: {
'/api': 'http://localhost:8000',
'/file': 'http://localhost:8000',
'/media': 'http://localhost:8000',
'/upload': 'http://localhost:8000',
'/api': 'http://localhost:10801',
'/file': 'http://localhost:10801',
'/media': 'http://localhost:10801',
'/upload': 'http://localhost:10801',
},
},
}));