From 017e081b703bda19fe2821999fffc330ae2b2940 Mon Sep 17 00:00:00 2001 From: monoid Date: Wed, 17 Apr 2024 00:27:51 +0900 Subject: [PATCH] chore: config load env --- packages/client/vite.config.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/client/vite.config.ts b/packages/client/vite.config.ts index 405876c..327a9e7 100644 --- a/packages/client/vite.config.ts +++ b/packages/client/vite.config.ts @@ -1,9 +1,11 @@ -import { defineConfig } from 'vite' +import { defineConfig, loadEnv } from 'vite' import path from 'node:path' import react from '@vitejs/plugin-react-swc' // https://vitejs.dev/config/ -export default defineConfig({ +export default defineConfig(({ mode }) => { + const env = loadEnv(mode, process.cwd(), ""); + return { plugins: [react()], resolve: { alias: { @@ -12,7 +14,7 @@ export default defineConfig({ }, server: { proxy: { - '/api': "https://aeolian.prelude.duckdns.org" + '/api': env.API_BASE_URL ?? 'http://localhost:8000', } } -}) +}})