File tree 1 file changed +9
-2
lines changed
1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -2,11 +2,18 @@ import react from '@vitejs/plugin-react'
2
2
import { defineConfig , loadEnv } from 'vite'
3
3
4
4
export default ( { mode } ) => {
5
- // Load app-level env vars to node-level env vars.
6
- process . env = { ... process . env , ... loadEnv ( mode , process . cwd ( ) ) }
5
+ // Load environment variables and expose them as Vite environment variables
6
+ const env = loadEnv ( mode , process . cwd ( ) )
7
7
8
8
return defineConfig ( {
9
9
base : '/RubyLive/' ,
10
10
plugins : [ react ( ) ] ,
11
+ define : {
12
+ // Explicitly define the variables you want to inject into the build
13
+ 'process.env' : process . env , // This ensures Node-level env vars are accessible if needed
14
+ 'import.meta.env.VITE_OPENAI_API_KEY' : JSON . stringify ( env . VITE_OPENAI_API_KEY ) ,
15
+ 'import.meta.env.VITE_SIMLI_API_KEY' : JSON . stringify ( env . VITE_SIMLI_API_KEY ) ,
16
+ 'import.meta.env.VITE_ELEVENLABS_API_KEY' : JSON . stringify ( env . VITE_ELEVENLABS_API_KEY ) ,
17
+ } ,
11
18
} )
12
19
}
You can’t perform that action at this time.
0 commit comments