Files
AiTool/frontend_spa/vite.config.ts
2026-03-18 17:01:10 +08:00

36 lines
792 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import path from "path";
export default defineConfig({
plugins: [react()],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
server: {
port: 3000,
strictPort: true,
proxy: {
"/api": {
target: process.env.VITE_DEV_PROXY_TARGET ?? "http://localhost:8000",
changeOrigin: true,
secure: false,
// dev 对齐生产 Nginx/api/* -> backend /*
rewrite: (p) => p.replace(/^\/api/, ""),
},
"/data": {
target: process.env.VITE_DEV_PROXY_TARGET ?? "http://localhost:8000",
changeOrigin: true,
secure: false,
},
},
},
build: {
outDir: "dist",
sourcemap: true,
},
});