tower / interior-flight / files / vite.config.ts
Branch interior-flight · default branch · all branches
vite.config.ts
cf4f8772 2026-09-07 Pavel Safronov | 1 | import { defineConfig } from 'vite' |
| 2 | ||
4a8aed84 2026-09-07 Pavel Safronov | 3 | /** |
| 4 | * Relative asset paths by default, so the same build works wherever Pages puts it. | |
| 5 | * | |
| 6 | * GitLab serves project pages either at https://<user>.gitlab.io/<project>/ or, if | |
| 7 | * unique domains are on, at the root of a generated domain. A hard-coded `/tower/` | |
| 8 | * base 404s every asset in the second case, and there is no way to know which one | |
| 9 | * applies until the first deploy. Relative paths are correct for both. | |
| 10 | * | |
| 11 | * Set BASE to override — an absolute base is needed if this ever gains client-side | |
| 12 | * routing, since relative URLs resolve against the current path rather than the app | |
| 13 | * root. `??` would not catch BASE="", so the check is explicit. | |
| 14 | */ | |
| 15 | const base = process.env.BASE || './' | |
cf4f8772 2026-09-07 Pavel Safronov | 16 | |
62458672 2026-09-07 Pavel Safronov | 17 | export default defineConfig({ |
| 18 | base, | |
| 19 | // Vite's static directory is `static/`, not the default `public/`, because | |
| 20 | // GitLab Pages requires its artifact to be a directory named `public` — and | |
| 21 | // `mv dist public` does not rename when `public/` already exists, it moves dist | |
| 22 | // *inside* it. The collision is silent and produces a 404 at the site root. | |
| 23 | publicDir: 'static', | |
aa55ae67 2026-09-07 Pavel Safronov | 24 | build: { |
| 25 | target: 'es2022', | |
| 26 | // Three.js is ~515 kB and is deliberately split into its own chunk, loaded | |
| 27 | // only when the exterior view is opened. Raise the threshold past it so the | |
| 28 | // warning stays meaningful for chunks that are large by accident. | |
| 29 | chunkSizeWarningLimit: 600, | |
| 30 | }, | |
62458672 2026-09-07 Pavel Safronov | 31 | }) |