import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import path from 'path';

export default defineConfig({
  plugins: [react()],
  base: '/',
  envDir: '../../', // Pick up .env.local from project root (for VITE_CONVEX_URL)
  resolve: {
    dedupe: ['react', 'react-dom'],
    alias: {
      '@discord-clone/shared': path.resolve(__dirname, '../../packages/shared'),
      '@discord-clone/platform-web': path.resolve(__dirname, '../../packages/platform-web'),
    },
  },
  build: {
    outDir: 'dist',
    chunkSizeWarningLimit: 1000,
  },
});
