Skip to content

Commit 4eeb247

Browse files
committed
fix: skip vite server config during build
1 parent 6387acf commit 4eeb247

1 file changed

Lines changed: 14 additions & 10 deletions

File tree

packages/web/vite.config.ts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import path from "node:path";
22
import react from "@vitejs/plugin-react";
33
import { 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

2428
function getEnv(name: string): string {
2529
const val = process.env[name];

0 commit comments

Comments
 (0)