mirror of
https://github.com/db9979/tidefront.git
synced 2026-12-06 12:54:09 +01:00
- 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.
43 lines
1.5 KiB
TypeScript
43 lines
1.5 KiB
TypeScript
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 },
|
||
},
|
||
},
|
||
});
|