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

export default defineConfig({
  root: __dirname,
  resolve: {
    alias: {
      '@': path.resolve(__dirname, 'src'),
    },
  },
  plugins: [react(), Pages({ dirs: ['src/app'] })],
  build: {
    outDir: 'dist',
    rollupOptions: {
      output: {
        manualChunks: {
          // React core
          'react-vendor': [
            'react',
            'react-dom',
            'react-router',
            'react-router-dom',
          ],
          // UI libraries
          'ui-vendor': ['@heroui/react'],
        },
      },
    },
  },
})
