2026-04-17 17:20:41 +08:00
|
|
|
|
import tailwindcss from '@tailwindcss/vite';
|
|
|
|
|
|
import react from '@vitejs/plugin-react';
|
2026-04-21 14:57:52 +08:00
|
|
|
|
import path, { resolve } from 'path';
|
|
|
|
|
|
import { defineConfig, loadEnv } from 'vite';
|
2026-04-17 17:20:41 +08:00
|
|
|
|
|
2026-04-21 14:57:52 +08:00
|
|
|
|
export default defineConfig(({ mode }) => {
|
|
|
|
|
|
const env = loadEnv(mode, '.', '');
|
|
|
|
|
|
return {
|
|
|
|
|
|
plugins: [react(), tailwindcss()],
|
|
|
|
|
|
define: {
|
|
|
|
|
|
'process.env.GEMINI_API_KEY': JSON.stringify(env.GEMINI_API_KEY),
|
|
|
|
|
|
},
|
|
|
|
|
|
resolve: {
|
|
|
|
|
|
alias: {
|
|
|
|
|
|
//'@': path.resolve(__dirname, '.'),
|
|
|
|
|
|
'@': resolve('src'),
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
server: {
|
|
|
|
|
|
// HMR is disabled in AI Studio via DISABLE_HMR env var.
|
|
|
|
|
|
// Do not modifyâfile watching is disabled to prevent flickering during agent edits.
|
|
|
|
|
|
hmr: process.env.DISABLE_HMR !== 'true',
|
|
|
|
|
|
},
|
|
|
|
|
|
};
|
2026-04-17 17:20:41 +08:00
|
|
|
|
});
|