Files
DPM/vite.config.js
T
2026-05-12 23:19:37 +08:00

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',
},
},
}));