44 lines
1.6 KiB
JavaScript
44 lines
1.6 KiB
JavaScript
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({
|
|
input: ['resources/css/app.css', 'resources/js/app.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/**'],
|
|
},
|
|
},
|
|
});
|