1
0

feat: 搭建前后端可执行程序示例

This commit is contained in:
2026-05-09 12:25:39 +08:00
commit 5b412c624d
27 changed files with 1860 additions and 0 deletions

25
vite.config.ts Normal file
View File

@@ -0,0 +1,25 @@
import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";
const backendPort = Number(process.env.BACKEND_PORT ?? process.env.PORT ?? 3000);
export default defineConfig({
root: "src/web",
plugins: [react()],
server: {
host: "127.0.0.1",
port: 5173,
strictPort: true,
proxy: {
"/api": {
target: `http://127.0.0.1:${backendPort}`,
changeOrigin: true,
},
},
},
build: {
outDir: "../../dist/web",
emptyOutDir: true,
assetsDir: "assets",
},
});