File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import path from "node:path";
22import react from "@vitejs/plugin-react" ;
33import { defineConfig } from "vite" ;
44
5- export default defineConfig ( {
5+ export default defineConfig ( ( { command } ) => ( {
66 plugins : [ react ( ) ] ,
77 resolve : {
88 alias : {
@@ -11,15 +11,19 @@ export default defineConfig({
1111 } ,
1212 envDir : "../../" ,
1313 envPrefix : "PUBLIC_" ,
14- server : {
15- port : getPort ( getEnv ( "BASE_URL" ) ) ,
16- proxy : {
17- "/api" : {
18- target : `http://localhost:${ getEnv ( "EXTERNAL_SERVER_PORT" ) } ` ,
19- } ,
20- } ,
21- } ,
22- } ) ;
14+ ...( command === "serve"
15+ ? {
16+ server : {
17+ port : getPort ( getEnv ( "BASE_URL" ) ) ,
18+ proxy : {
19+ "/api" : {
20+ target : `http://localhost:${ getEnv ( "EXTERNAL_SERVER_PORT" ) } ` ,
21+ } ,
22+ } ,
23+ } ,
24+ }
25+ : { } ) ,
26+ } ) ) ;
2327
2428function getEnv ( name : string ) : string {
2529 const val = process . env [ name ] ;
You can’t perform that action at this time.
0 commit comments