perf: bundle React in production mode
`build:js` was shipping React's development build. That cost 222 KB of the 566 KB bundle (61 KB of 164 KB gzipped), ran every element creation through dev-only validation, and left `StrictMode` double-invoking effects — so `fetchFeed` fired twice and every reader downloaded the feed twice on every single load. On a 4G/4×-CPU profile with the cache cold: first contentful paint 1480ms → 972ms, the feed on screen 1766ms → 1261ms, and two feed requests → one. The flag is `--production` and not `--define process.env.NODE_ENV='"production"'`, which is the obvious-looking version and produces a bundle that does not run at all: the define flips React to its production build while the JSX transform keeps emitting `jsxDEV`, so the page dies on `z is not a function` with a blank body. Both variants build clean, typecheck clean and pass all 843 tests, because nothing in the suite executes the bundle — so AGENTS.md now says to open a browser before believing this one. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5
parent
23ad2ad797
commit
a7cf59d8e4
+1
-1
@@ -9,7 +9,7 @@
|
||||
"build:feed": "bun run scripts/build-feed.ts",
|
||||
"refresh": "bun run scripts/refresh-sources.ts",
|
||||
"build:css": "bunx @tailwindcss/cli -i src/client/styles.css -o public/styles.css --minify",
|
||||
"build:js": "bun build src/client/main.tsx --outfile public/main.js --minify",
|
||||
"build:js": "bun build src/client/main.tsx --outfile public/main.js --minify --production",
|
||||
"build": "bun run build:feed && bun run build:css && bun run build:js && bun run build:static",
|
||||
"dev": "bun run build && bun run serve.ts",
|
||||
"build:static": "bun run scripts/build-static.ts",
|
||||
|
||||
Reference in New Issue
Block a user