fix:优化项目内容
This commit is contained in:
35
frontend_spa/vite.config.ts
Normal file
35
frontend_spa/vite.config.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
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,
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user