Skip to content

Keep production UI builds below the existing chunk limit - #95

Merged
pjeweb merged 1 commit into
osb/integrationfrom
osb/pr/frontend-bundle-boundaries
Nov 15, 2026
Merged

pjeweb merged 1 commit into
osb/integrationfrom
osb/pr/frontend-bundle-boundaries

Conversation

@pjeweb

@pjeweb pjeweb commented Nov 14, 2026 •

Copy link
Copy Markdown

Why

The production build fails whenever one chunk grows past 1,159 kB, and the base is only about 2 kB below that. Almost any small UI addition now breaks the build: several open PRs (for example #77, #79 and #74) fail it on their own. The cause is that the bundler collects shared application code into a chunk named after the development tools, which aren't even shipped in production.

What

  • The production build has room again: the largest chunk drops from about 1,157 kB to about 796 kB, with all features, languages and lazy dialogs kept.
  • The size limits themselves are unchanged.
  • No screen or component changes.
  • apps/frontend/README.md explains why production code must not get a manual chunk, and the size trade-off.

How: the development tools are already removed from production builds, so I dropped their manual devtools chunk in vite.config.ts and let the bundler split shared code where it naturally falls. The notification bundle check looked up locale chunks by prefix and would mistake a helper such as network-speed-….js for the network locale once those files appear, so it now matches the exact name plus hash.

The trade-off: smaller chunks compress slightly worse. Total gzip grows by about 22 kB (about 2%) and the first page load by about 21 kB, both well under their existing budgets.

How to verify

Run the production frontend build: the warning check and the four gzip budgets pass. scripts/ci/notification-bundle.test.ts covers the new name matching. Open the built app at phone and desktop width; navigation, theme and language switching work as before.

Testing and limits
  • Full frontend suite, lint, type checks (no Svelte errors or warnings), the build and bundle contracts and the production build pass. The emitted notification strings render in all ten languages.
  • I also built the open UI PRs merged on top of each other with this change. Every step stayed within all limits, and the largest chunk ended at about 805 kB. Without this change the same combination produces a chunk about 25 kB over the limit.
  • A production browser smoke test at 1280 and 390 px passed.
  • This buys headroom but doesn't stop growth; a future large feature can still need its own split.

Risks

Chunk loading order changes, so a circular import could in theory surface as an initialization error at load time. The full suite and the browser smoke test didn't show one. Rolling back is restoring the four removed lines.


Checklist

  • Docs updated if behavior or structure changed (Rule A: AGENTS.md within budget, README, docs/, versions.yaml)
  • User docs (Rule G): no user-visible change, OR ceralive-docs PR updates English and Spanish, plus ceralive-website PR if a landing claim changed
  • Started from updated main; branch rebased on latest canonical branch (Rule B)
  • Rule D local-scratch reference check passes for tracked files
  • Tests pass; QA evidence attached or linked

@pjeweb
pjeweb merged commit 677ce63 into osb/integration Nov 15, 2026
3 checks passed
@pjeweb pjeweb added the upstream: waits for intent Needs an issue or maintainer agreement before an upstream proposal. label Nov 16, 2026
@pjeweb

pjeweb commented Nov 25, 2026

Copy link
Copy Markdown
Author

Still carried in the integration train and not upstream, so it continues as #245.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

upstream: waits for intent Needs an issue or maintainer agreement before an upstream proposal.

Development

Successfully merging this pull request may close these issues.

1 participant