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

export default defineConfig({
    plugins: [
        react(),
        tailwindcss(),
    ],
    optimizeDeps: {
        include: [
            'react',
            'react-dom',
            'react-router-dom',
        ],
        exclude: []
    },
    resolve: {
        alias: {
            '@': path.resolve(__dirname, './src'),
        },
    },
    build: {
        rolldownOptions: {
            external: [
                'libs/',
                'target/',
            ],
        }
    },
    server: {
        port: 4180,
        hmr: {
            overlay: true,
            path: '/@vite-hmr',
        },
        watch: {
            ignored: [
                '**/target/**',
                '**/libs/**',
                '**/node_modules/**',
            ],
        },
        proxy: {
            '/ws': {
                target: 'http://localhost:8080',
                ws: true,
                changeOrigin: true,
            },
            '/api': {
                target: 'http://localhost:8080',
                changeOrigin: true,
            },
        },
    },
})
