import { defineConfig } from "vite"; import react from "@vitejs/plugin-react-swc"; import path from "path"; import { componentTagger } from "lovable-tagger"; // https://vitejs.dev/config/ export default defineConfig(({ mode }) => ({ server: { host: "::", port: 8080, }, plugins: [ react(), mode === 'development' && componentTagger(), ].filter(Boolean), resolve: { alias: { "@": path.resolve(__dirname, "./src"), }, }, build: { // Optimize build for better performance rollupOptions: { output: { manualChunks: { // Separate vendor chunks for better caching 'react-vendor': ['react', 'react-dom', 'react-router-dom'], 'ui-vendor': ['lucide-react', '@radix-ui/react-slot'], 'gsap-vendor': ['gsap'], }, }, }, // Increase chunk size warning limit (GSAP is large) chunkSizeWarningLimit: 1000, // Enable minification and compression minify: 'terser', terserOptions: { compress: { drop_console: mode === 'production', drop_debugger: mode === 'production', }, }, }, // Optimize dependencies optimizeDeps: { include: ['react', 'react-dom', 'react-router-dom'], exclude: ['gsap'], }, }));