Files
app/frontend/vite.config.ts
T
stroblme bd2a24df2b
Docs / docs (push) Successful in 25s
Playwright Tests / test-playwright (1, 2) (push) Failing after 2m34s
Playwright Tests / test-playwright (2, 2) (push) Failing after 22s
pre-commit / pre-commit (push) Failing after 2m18s
Test Backend / test-backend (3.12) (push) Successful in 4m56s
Test Backend / test-backend (3.14) (push) Successful in 4m38s
Compose Smoke Test / test-compose (push) Failing after 23s
Playwright Tests / merge-reports (push) Failing after 2m24s
Entry chunk: signup and the form schemas leave it, build runs without warnings
The entry is 798 kB (259 kB gzipped) instead of 927 kB (298 kB). Signup's
`export default` kept it unsplit, and login, recover and reset-password left a
bare `z.object(...)` statement in their route stubs (reset-password also read
its search through Zod), which held all of Zod and react-hook-form in the entry.
The schemas are factories now, reset-password validates its search by hand.

The shell routes keep their component in the entry on purpose
(`codeSplitGroupings: []`, no `export default`): splitting them out measured
about 60 chunks per signed-in screen and a slower flow list. The Zod
`@__PURE__` comment warning is filtered and the chunk limit is 850 kB, each with
a comment saying why.

At 4x CPU on slow 4G the signed-in screens load 5 to 9% sooner, view 6%; login
13% later (the form chunk is one more hop). On a LAN they are within noise.

Claude-Session: https://claude.ai/code/session_01SSi5AvZ7pFmySK8zy3NPMh
2026-10-28 18:02:06 +01:00

44 lines
1.3 KiB
TypeScript

import path from "node:path"
import tailwindcss from "@tailwindcss/vite"
import { tanstackRouter } from "@tanstack/router-plugin/vite"
import react from "@vitejs/plugin-react-swc"
import { defineConfig } from "vite"
// https://vitejs.dev/config/
export default defineConfig({
// A portal serves this bundle under a path of its own and caches one copy
// for every instance, so asset URLs have to be absolute under that
// prefix. Unset — every ordinary build — this stays "/".
base: process.env.VITE_BASE || "/",
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
build: {
// The entry holds React, the router, the query client and the shell, and
// cannot get below this. A bigger chunk than that is worth a warning.
chunkSizeWarningLimit: 850,
rollupOptions: {
onwarn(warning, defaultHandler) {
// Zod's own comments name `@__PURE__`, which Rollup reads as a
// misplaced annotation. Nothing to fix on our side.
if (
warning.code === "INVALID_ANNOTATION" &&
warning.id?.includes("/node_modules/zod/")
)
return
defaultHandler(warning)
},
},
},
plugins: [
tanstackRouter({
target: "react",
autoCodeSplitting: true,
}),
react(),
tailwindcss(),
],
})