import tailwindcss from '@tailwindcss/vite'; import react from '@vitejs/plugin-react'; import path from 'node:path'; import { fileURLToPath } from 'node:url'; import { defineConfig } from 'vite'; const here = path.dirname(fileURLToPath(import.meta.url)); export default defineConfig({ root: path.resolve(here, 'web'), /** * Relativni base. Aplikace bezi za reverse proxy na /apps/, ktery * neni znamy pri buildu. Server proto do index.html vklada * podle ROOT_PATH a relativni odkazy se podle nej slozi spravne. */ base: './', plugins: [react(), tailwindcss()], resolve: { // Musi zustat v souladu s "paths" ve web/tsconfig.json alias: { '@': path.resolve(here, 'web/src'), }, }, server: { port: 5173, proxy: { // Lokalni vyvoj: web na 5173 vola API na 3000, bez reseni CORS. '/api': { target: 'http://localhost:3000', changeOrigin: true }, '/webhook': { target: 'http://localhost:3000', changeOrigin: true }, }, }, build: { // Server tuhle slozku obsluhuje jako statiku, viz src/index.ts. outDir: path.resolve(here, 'dist/public'), emptyOutDir: true, sourcemap: true, }, });