Files
2026-07-07 19:26:30 +02:00

53 lines
1.6 KiB
JavaScript

// Vite build konfiguráció
import { defineConfig } from 'vite';
import tailwindcss from '@tailwindcss/vite';
import Icons from 'unplugin-icons/vite';
export default defineConfig({
plugins: [
// Tailwind CSS Vite plugin - natív integráció, nem kell postcss
tailwindcss(),
// Ikonok: ~icons/tabler/<név> import, csak a használtak kerülnek a bundle-be.
// compiler 'raw' -> nyers SVG string (vanilla JS-hez, innerHTML-be illeszthető)
Icons({ compiler: 'raw' })
],
build: {
// Build output a szerver által kiszolgált public mappába
outDir: '../public',
emptyOutDir: true
},
server: {
port: 5173,
proxy: {
// API kérések proxyzása a backend szerverre fejlesztési módban
'/api': {
target: 'http://localhost:3000',
changeOrigin: true
},
// Socket.io WebSocket proxyzása
'/socket.io': {
target: 'http://localhost:3000',
changeOrigin: true,
ws: true
},
// Webhook kérések proxyzása (UUID formátumú path-ok)
'/': {
target: 'http://localhost:3000',
changeOrigin: true,
// Csak UUID-szerű path-okat proxyzunk, a Vite statikus fájljait nem
bypass(req) {
// Ha Accept fejlécben van text/html vagy a Vite HMR, ne proxyzza
if (req.headers.accept && req.headers.accept.includes('text/html')) {
return req.url;
}
if (req.url.startsWith('/@') || req.url.startsWith('/src') || req.url.startsWith('/node_modules')) {
return req.url;
}
}
}
}
}
});