Files
tidefront/apps/web/vite.config.ts
T
db9979 6aa3b05f3b Web: Windfahnen nur über See, Haupt-Chunk verkleinert
- Wetter-Übersicht: Windfahnen nur noch auf Meer-/Küstenfeldern; liegt die Rasterzelle an Land,
  rückt die Fahne auf das nächste Seefeld im Umkreis eines Feldes (Isobaren bleiben über Land).
- Bundle: React sowie TanStack Query/tRPC in eigene, lange cachebare Chunks; Startmodule in einem
  App-Chunk statt vieler Kleinstteile. Anmeldung und Hafenwahl werden verzögert geladen,
  das Änderungsprotokoll (CHANGELOG.md) erst beim Öffnen. Haupt-Chunk 562 kB -> 246 kB.
2026-11-27 08:35:06 +01:00

43 lines
1.5 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import tailwindcss from "@tailwindcss/vite";
import { readFileSync } from "node:fs";
// Versionsnummer aus der Wurzel-package.json und Build-Zeitpunkt für die Anzeige in der App
const rootPkg = JSON.parse(readFileSync(new URL("../../package.json", import.meta.url), "utf8")) as { version: string };
const target = process.env.TF_API ?? "http://localhost:18080";
export default defineConfig({
plugins: [react(), tailwindcss()],
define: {
__APP_VERSION__: JSON.stringify(rootPkg.version),
__BUILD_TIME__: JSON.stringify(new Date().toISOString()),
},
build: {
outDir: "dist",
emptyOutDir: true,
chunkSizeWarningLimit: 400,
rolldownOptions: {
output: {
// Bibliotheken in eigene, lange cachebare Chunks: ein Spiel-Update lädt nur den App-Code neu.
// PixiJS bleibt bewusst außen vor – es hängt nur an der verzögert geladenen Karte.
codeSplitting: {
groups: [
{ name: "react", test: /node_modules[\\/](react|react-dom|scheduler)[\\/]/, priority: 20 },
{ name: "query", test: /node_modules[\\/]@(tanstack|trpc)[\\/]/, priority: 10 },
// Alles, was der Start ohnehin braucht, in einen App-Chunk statt vieler Kleinstteile.
{ name: "app", tags: ["$initial"], priority: 0 },
],
},
},
},
},
server: {
proxy: {
"/trpc": { target, changeOrigin: true },
"/ws": { target, ws: true, changeOrigin: true },
},
},
});