1+ import { readFileSync } from "fs" ;
2+
13import { defineConfig } from "vite" ;
24import react from "@vitejs/plugin-react" ;
35import tsconfigPaths from "vite-tsconfig-paths" ;
4- import { readFileSync } from "fs" ;
5- import tailwindcss from "@tailwindcss/vite"
6+ import tailwindcss from "@tailwindcss/vite" ;
67
78// 读取package.json获取版本号
89const packageJson = JSON . parse ( readFileSync ( "./package.json" , "utf-8" ) ) ;
@@ -12,24 +13,24 @@ export default defineConfig(({ mode }) => ({
1213 plugins : [ react ( ) , tsconfigPaths ( ) , tailwindcss ( ) ] ,
1314 define : {
1415 __APP_VERSION__ : JSON . stringify ( packageJson . version ) ,
15- __DEV_MODE__ : JSON . stringify ( mode === ' development' ) ,
16+ __DEV_MODE__ : JSON . stringify ( mode === " development" ) ,
1617 } ,
1718 build : {
18- outDir : ' ../cmd/server/dist' ,
19+ outDir : " ../cmd/server/dist" ,
1920 } ,
2021 server : {
2122 proxy : {
22- ' /api' : {
23- target : process . env . VITE_API_BASE || ' http://localhost:3000' ,
23+ " /api" : {
24+ target : process . env . VITE_API_BASE || " http://localhost:3000" ,
2425 changeOrigin : true ,
2526 secure : false ,
2627 ws : true , // 启用 WebSocket 代理
2728 } ,
28- ' /docs-proxy' : {
29- target : ' https://raw.githubusercontent.com' ,
29+ " /docs-proxy" : {
30+ target : " https://raw.githubusercontent.com" ,
3031 changeOrigin : true ,
3132 secure : true ,
32- rewrite : ( path ) => path . replace ( / ^ \/ d o c s - p r o x y / , '' ) ,
33+ rewrite : ( path ) => path . replace ( / ^ \/ d o c s - p r o x y / , "" ) ,
3334 } ,
3435 } ,
3536 } ,
0 commit comments