import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import tailwindcss from '@tailwindcss/vite';

export default defineConfig({
    plugins: [
        laravel({
            input: ['resources/css/app.css', 'resources/js/app.js'],
            refresh: true,
        }),
        tailwindcss(),
    ],
    server: {
        // Bind all interfaces inside the container; the browser reaches the VM.
        host: '0.0.0.0',
        port: 5173,
        strictPort: true,
        cors: true,
        // Remote HMR: hot file + websocket point at the VM, not 0.0.0.0/localhost.
        hmr: {
            host: '10.10.90.136',
        },
        // The repo is rooted in $HOME — keep the watcher off heavy/irrelevant trees.
        watch: {
            ignored: [
                '**/vendor/**',
                '**/node_modules/**',
                '**/storage/**',
                '**/.git/**',
                '**/.cache/**',
                '**/.npm/**',
                '**/.vscode-server/**',
                '**/.dotnet/**',
                '**/.composer/**',
                '**/.config/**',
                '**/.claude/**',
                '**/.local/**',
            ],
        },
    },
});
