Skip to content

Commit 15187a5

Browse files
committed
use .env only in dev
1 parent 2e6c9a0 commit 15187a5

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

packages/web/vite.config.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ export default defineConfig(({ command }) => ({
99
"@": path.resolve(__dirname, "./src"),
1010
},
1111
},
12-
envDir: "../../",
1312
envPrefix: "PUBLIC_",
1413
...(command === "serve"
1514
? {
15+
envDir: "../../",
1616
server: {
1717
port: getPort(getEnv("BASE_URL")),
1818
proxy: {
@@ -22,7 +22,13 @@ export default defineConfig(({ command }) => ({
2222
},
2323
},
2424
}
25-
: {}),
25+
: {
26+
define: {
27+
"import.meta.env.PUBLIC_API_URL": JSON.stringify(
28+
getEnv("PUBLIC_API_URL"),
29+
),
30+
},
31+
}),
2632
}));
2733

2834
function getEnv(name: string): string {

0 commit comments

Comments
 (0)