From dadd16c4693025209f8c53f3d2effa9957cdd6ea Mon Sep 17 00:00:00 2001 From: moon Date: Fri, 11 Oct 2024 02:14:22 -0700 Subject: [PATCH] load env --- vite.config.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/vite.config.ts b/vite.config.ts index ce22ed1..aa08414 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,8 +1,12 @@ import react from '@vitejs/plugin-react' -import { defineConfig } from 'vite' +import { defineConfig, loadEnv } from 'vite' -// https://vitejs.dev/config/ -export default defineConfig({ - base: '/RubyLive/', - plugins: [react()], -}) +export default ({ mode }) => { + // Load app-level env vars to node-level env vars. + process.env = { ...process.env, ...loadEnv(mode, process.cwd()) } + + return defineConfig({ + base: '/RubyLive/', + plugins: [react()], + }) +}