import { defineConfig, loadEnv } from 'vite' import react from '@vitejs/plugin-react' import path from 'path' export default defineConfig(({ mode }) => { // Cargar variables de entorno del directorio raĆ­z const env = loadEnv(mode, '../../', '') return { plugins: [react()], resolve: { alias: { '@': path.resolve(__dirname, './src'), '@shared': path.resolve(__dirname, '../../shared'), '@avanzacast/shared-utils': path.resolve(__dirname, '../../shared/utils'), '@avanzacast/shared-types': path.resolve(__dirname, '../../shared/types'), '@avanzacast/shared-hooks': path.resolve(__dirname, '../../shared/hooks'), } }, server: { port: 3020, host: true, fs: { // Allow serving files from the shared folder (monorepo) allow: [ path.resolve(__dirname), path.resolve(__dirname, '../../shared') ], // Disable strict fs checking so imports from outside project root work strict: false }, // Usar HTTP en dev para pruebas E2E locales (localhost permite getUserMedia sin HTTPS en muchos navegadores) watch: { usePolling: true } }, define: { // Exponer variables de entorno al cliente 'import.meta.env.VITE_LIVEKIT_URL': JSON.stringify(env.LIVEKIT_URL), 'import.meta.env.VITE_LIVEKIT_API_KEY': JSON.stringify(env.LIVEKIT_API_KEY), 'import.meta.env.VITE_LIVEKIT_API_SECRET': JSON.stringify(env.LIVEKIT_API_SECRET), }, } })