Use Vite env key for Gemini

This commit is contained in:
Anthony
2025-11-27 21:19:46 +08:00
parent 7f75b44af1
commit 1cdcc08eae
5 changed files with 12 additions and 17 deletions

View File

@@ -1,16 +1,6 @@
import { defineConfig, loadEnv } from 'vite';
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
export default defineConfig(({ mode }) => {
// Load env file based on `mode` in the current working directory.
const env = loadEnv(mode, (process as any).cwd(), '');
return {
plugins: [react()],
define: {
// This allows the app code to continue using process.env.API_KEY
// even though it is running in the browser.
'process.env.API_KEY': JSON.stringify(env.API_KEY)
}
};
export default defineConfig({
plugins: [react()]
});