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

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [react(), svgr()],
  resolve: {
    alias: {
      '@': '/src',
      '@/components': '/src/components',
      '@/layouts': '/src/layouts',
      '@/pages': '/src/pages',
      '@/tools': '/src/tools',
      '@/hooks': '/src/hooks',
      '@/utils': '/src/utils',
      '@/services': '/src/services',
      '@/clinical': '/src/clinical',
      '@/views': '/src/views',
      '@/config': '/src/config',
      '@/data': '/src/data',
      '@/validators': '/src/validators',
      '@/types': '/src/types',
      '@/components/ui': '/src/components/ui',
      '@/components/layout': '/src/components/layout',
    },
  },
  server: {
    port: 5173,
    open: true,
  },
  build: {
    outDir: 'dist',
    sourcemap: true,
    rollupOptions: {
      output: {
        manualChunks: {
          'react-vendor': ['react', 'react-dom', 'react-router-dom'],
          'ui-vendor': ['lucide-react', 'clsx', 'tailwind-merge', 'next-themes', 'sonner'],
        },
      },
    },
  },
})