import path from 'path'; import { defineConfig, loadEnv } from 'vite'; import react from '@vitejs/plugin-react'; export default defineConfig(({ mode }) => { const env = loadEnv(mode, '.', ''); return { server: { port: 3000, host: '0.0.0.0', allowedHosts: ['note.iieasy.ru'], proxy: { '/api': { target: process.env.API_PROXY_TARGET || 'http://localhost:4000', changeOrigin: true, secure: false }, '/uploads': { target: process.env.API_PROXY_TARGET || 'http://localhost:4000', changeOrigin: true, secure: false } } }, preview: { port: 3000, host: '0.0.0.0' }, plugins: [react()], envPrefix: 'VITE_', resolve: { alias: { '@': path.resolve(__dirname, '.'), } }, build: { rollupOptions: { output: { manualChunks: (id) => { if (id.includes('node_modules/react/') || id.includes('node_modules/react-dom/')) { return 'vendor-react'; } if (id.includes('node_modules/lucide-react')) { return 'vendor-lucide'; } } } } } }; });