feat: split vendor bundles with cycle-safe manual chunks #2

Merged
jesse merged 5 commits from feat/build-code-splitting into main 2026-05-15 03:53:32 +02:00
Owner

Summary

Introduces a manualChunks strategy that carves vendor code into cacheable chunks and lazy-loads heavy route panels. Renders the React tree before the init-error IPC resolves so a hung backend can no longer blank the window.

Blank-page regression fixed

The chunking work shipped a circular chunk dependency: loose id.includes matchers pulled @floating-ui/react* into vendor-react while their deps stayed in vendor, leaving React's exports undefined at module load (Cannot read properties of undefined (reading 'useLayoutEffect')). Fixes:

  • Matchers anchored to /node_modules/<pkg>/ package boundaries
  • Rollup's CJS helper isolated in its own dependency-free leaf chunk
  • cmdk co-located with the Radix layer it depends on (broke a second latent vendorvendor-radix cycle)

Guardrail

Adds assertNoCircularChunks — a build-time Vite plugin that fails the build on any circular chunk dependency, so this class of bug surfaces in CI instead of as a white screen.

Tests

  • tests/unit/manualChunks.test.ts — chunk routing, incl. cycle regressions
  • tests/unit/assertNoCircularChunks.test.ts — cycle-detection guard
  • tests/integration/mainBootstrap.test.tsx — bootstrap renders even when init-error IPC hangs

Full suite: 70 files, 465 passed / 1 skipped. Typecheck clean. Built bundle verified to render in-browser.

🤖 Generated with Claude Code

## Summary Introduces a `manualChunks` strategy that carves vendor code into cacheable chunks and lazy-loads heavy route panels. Renders the React tree before the init-error IPC resolves so a hung backend can no longer blank the window. ## Blank-page regression fixed The chunking work shipped a circular chunk dependency: loose `id.includes` matchers pulled `@floating-ui/react*` into `vendor-react` while their deps stayed in `vendor`, leaving React's exports undefined at module load (`Cannot read properties of undefined (reading 'useLayoutEffect')`). Fixes: - Matchers anchored to `/node_modules/<pkg>/` package boundaries - Rollup's CJS helper isolated in its own dependency-free leaf chunk - `cmdk` co-located with the Radix layer it depends on (broke a second latent `vendor` ⇄ `vendor-radix` cycle) ## Guardrail Adds `assertNoCircularChunks` — a build-time Vite plugin that fails the build on any circular chunk dependency, so this class of bug surfaces in CI instead of as a white screen. ## Tests - `tests/unit/manualChunks.test.ts` — chunk routing, incl. cycle regressions - `tests/unit/assertNoCircularChunks.test.ts` — cycle-detection guard - `tests/integration/mainBootstrap.test.tsx` — bootstrap renders even when init-error IPC hangs Full suite: 70 files, 465 passed / 1 skipped. Typecheck clean. Built bundle verified to render in-browser. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
feat: split vendor bundles with cycle-safe manual chunks
Some checks failed
CI / Backend Checks (pull_request) Waiting to run
CI / Frontend Checks (pull_request) Failing after 8s
e7acd29306
Introduce a manualChunks strategy that carves vendor code into cacheable
chunks and lazy-loads heavy route panels. Render the React tree before the
init-error IPC resolves so a hung backend can no longer blank the window.

Fixes a blank-page regression in the chunking work: loose `id.includes`
matchers pulled `@floating-ui/react*` into `vendor-react` while their deps
stayed in `vendor`, forming a circular chunk dependency that left React's
exports undefined at module load. Matchers are now anchored to package
boundaries, Rollup's CJS helper is isolated in its own leaf chunk, and
`cmdk` is co-located with the Radix layer it depends on.

Add `assertNoCircularChunks`, a build-time guard that fails the build on
any circular chunk dependency, plus unit coverage for the chunk strategy
and an integration test for the bootstrap render path.
fix: resolve pre-existing prettier violations blocking Frontend CI
Some checks failed
CI / Backend Checks (pull_request) Waiting to run
CI / Frontend Checks (pull_request) Failing after 51s
d38d41c260
ProviderCard.tsx and UsageDashboard.tsx had whitespace/indentation that
failed `pnpm format:check` — the long-standing cause of the red Frontend
Checks job on main. Whitespace-only changes, no behavior impact.
ci: pin Forgejo workflow actions to existing v4 tags
Some checks failed
CI / Backend Checks (pull_request) Waiting to run
CI / Frontend Checks (pull_request) Failing after 2m52s
b1d52d69e7
setup-node@v6, pnpm/action-setup@v5 and actions/cache@v5 reference tags
that don't exist, so the Forgejo runner fails to resolve the actions and
the job dies at setup before any check runs — the long-standing cause of
the red Frontend/Backend Checks on main. Align with the @v4 majors used
by .github/workflows/ci-frontend.yml.
test: raise timeouts so slow CI runners don't fail integration flows
Some checks failed
CI / Backend Checks (pull_request) Waiting to run
CI / Frontend Checks (pull_request) Failing after 3m7s
0e7b2c6f37
CI's Frontend Checks failed on two integration tests that pass locally:
the long App provider-flow test exceeded vitest's 5s testTimeout, and a
SettingsDialog waitFor exceeded Testing Library's 1s asyncUtilTimeout.
Both are runner slowness (CI setup phase alone ~70s), not real defects.
Raise testTimeout/hookTimeout and asyncUtilTimeout to give heavy
integration renders headroom.
test: fix flaky useCompanionLifecycle unknown-profile race
Some checks failed
CI / Frontend Checks (pull_request) Successful in 3m20s
CI / Backend Checks (pull_request) Has been cancelled
80b3cbbcde
"treats unknown build profile values as unknown" waited on
buildProfile === "unknown", but that is also the initial useState value
— so waitFor resolved on the first render, before the build-profile
effect settled isRuntimeSwitchSupported, and the synchronous isDisabled
assertion raced the effect (~10% failure rate, surfaced on slow CI).
Wait on isDisabled inside waitFor so the assertion runs only after the
effect resolves. Hook unchanged; 0/50 failures after the fix.
jesse merged commit fb38741ce7 into main 2026-05-15 03:53:32 +02:00
jesse deleted branch feat/build-code-splitting 2026-05-15 03:53:33 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jesse/Nexus!2
No description provided.