Skip to content

Commit

Permalink
fix config
Browse files Browse the repository at this point in the history
  • Loading branch information
lalalune committed Oct 11, 2024
1 parent eec2a1b commit 027dc3a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,18 @@ import react from '@vitejs/plugin-react'
import { defineConfig, loadEnv } from 'vite'

export default ({ mode }) => {
// Load app-level env vars to node-level env vars.
process.env = { ...process.env, ...loadEnv(mode, process.cwd()) }
// Load environment variables and expose them as Vite environment variables
const env = loadEnv(mode, process.cwd())

return defineConfig({
base: '/RubyLive/',
plugins: [react()],
define: {
// Explicitly define the variables you want to inject into the build
'process.env': process.env, // This ensures Node-level env vars are accessible if needed
'import.meta.env.VITE_OPENAI_API_KEY': JSON.stringify(env.VITE_OPENAI_API_KEY),
'import.meta.env.VITE_SIMLI_API_KEY': JSON.stringify(env.VITE_SIMLI_API_KEY),
'import.meta.env.VITE_ELEVENLABS_API_KEY': JSON.stringify(env.VITE_ELEVENLABS_API_KEY),
},
})
}

0 comments on commit 027dc3a

Please sign in to comment.