CluPilotCloud/vite.config.js

39 lines
1.3 KiB
JavaScript

import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import tailwindcss from '@tailwindcss/vite';
// 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({
input: ['resources/css/app.css', 'resources/js/app.js'],
refresh: true,
}),
tailwindcss(),
],
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/**'],
},
},
});