import { defineConfig } from 'vite'; import laravel from 'laravel-vite-plugin'; // Tailwind v3 runs via PostCSS (postcss.config.js) — no Vite plugin. // Fonts are self-hosted locally (R14) — declared via @font-face in app.css, // NOT fetched from a CDN. No bunny()/Google Fonts provider here. // Vite listens on 5173 inside the container; Compose may publish it on a // different host port (VITE_PORT). The browser must connect to that published // port, so drive the HMR clientPort from VITE_PORT. const hmrHost = process.env.VITE_HMR_HOST; const hmrClientPort = Number(process.env.VITE_PORT || 5173); export default defineConfig({ plugins: [ laravel({ // site.js ist ein eigener Einstiegspunkt, kein Teil von app.js: es // startet Alpine, und auf Konsolen- und Portalseiten tut das schon // Livewire. Zwei Starts zerlegen beide. Siehe resources/js/site.js. // // terminal.js ist ebenfalls ein eigener Einstiegspunkt — nicht // weil die Terminalseite ohne Livewire liefe (sie ist eine // Vollseiten-Livewire-Komponente), sondern damit xterm.js nicht in // app.js landet und app.js nicht in ein Fenster, das nur eine // WebSocket-Verbindung und ein Terminal zeigt. Siehe // resources/js/terminal.js. input: ['resources/css/app.css', 'resources/js/app.js', 'resources/js/site.js', 'resources/js/terminal.js'], refresh: true, }), ], build: { // Not emptied on rebuild: a browser holding the previous page would // otherwise 404 on its stylesheet the moment we deploy, which is exactly // the "design is completely broken" symptom. Stale files are cheap. emptyOutDir: false, }, server: { host: '0.0.0.0', port: 5173, strictPort: true, // Browser connects here for HMR. Host env-driven (VITE_HMR_HOST); when // unset Vite infers it from the request. clientPort matches the port the // browser actually reaches (the Compose-published VITE_PORT). hmr: { ...(hmrHost ? { host: hmrHost } : {}), clientPort: hmrClientPort, }, watch: { usePolling: true, ignored: ['**/storage/framework/views/**'], }, }, });