import { defineConfig, loadEnv } from 'vite' import react from '@vitejs/plugin-react' // https://vitejs.dev/config/ export default defineConfig(({ mode }) => { // Load env file based on `mode` in the current working directory. // Cast process to any to fix property 'cwd' does not exist on type 'Process' error const env = loadEnv(mode, (process as any).cwd(), ''); return { plugins: [react()], build: { outDir: 'dist', sourcemap: false }, // This defines global constants that are replaced at build time define: { 'process.env.API_KEY': JSON.stringify(env.VITE_API_KEY || process.env.VITE_API_KEY || '') } } })