30 lines
701 B
JavaScript
30 lines
701 B
JavaScript
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()],
|
|
|
|
clearScreen: false,
|
|
server: {
|
|
port: 1420,
|
|
strictPort: true,
|
|
host: host || "127.0.0.1",
|
|
hmr: host
|
|
? { protocol: "ws", host, port: 1421 }
|
|
: undefined,
|
|
watch: {
|
|
ignored: ["**/src-tauri/**"],
|
|
},
|
|
// 开发时代理 API 请求到 Python/Rust 后端
|
|
proxy: {
|
|
'/api': 'http://localhost:8000',
|
|
'/file': 'http://localhost:8000',
|
|
'/media': 'http://localhost:8000',
|
|
'/upload': 'http://localhost:8000',
|
|
},
|
|
},
|
|
}));
|