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

export default defineConfig({
    plugins: [react()],
    resolve: {
        alias: { '@': path.resolve(__dirname, './src') }
    },
    server: {
        host: '0.0.0.0',
        port: 81,
        strictPort: true,
        allowedHosts: ['myndf.ensup-adm.net', 'localhost'],
        historyApiFallback: true,   // ✅ routes SPA
        proxy: {
            '/api': {
                target: 'http://backend:3024',
                changeOrigin: true,
                secure: false,
                ws: true
            },
            '/proxy-file': {
                target: 'http://backend:3024',
                changeOrigin: true,
                secure: false
            }
        }
    }
});
