Skip to content

Add browser bundle size checks - #640

Open
andrewiggins wants to merge 7 commits into
mainfrom
size-check
Open

Add browser bundle size checks#640
andrewiggins wants to merge 7 commits into
mainfrom
size-check

Conversation

@andrewiggins

Copy link
Copy Markdown
Contributor

What this changes

This adds browser bundle size checks for Remote DOM’s public packages.

The checks build the packages, bundle their public browser entry points with esbuild, compress the result with Brotli, and fail when a bundle grows past its limit. Core, Preact, and React have separate checks for host and remote code because those entry points run in different environments and are not normally shipped together.

The change also adds:

  • pnpm size for checking the limits locally
  • pnpm size:why for generating bundle visualizations
  • a blocking Bundle size 📦 CI job
  • contributor guidance for reviewing intentional growth

All Size Limit configuration, fixtures, and dependencies live in the private @remote-dom/size-limit workspace package.

Why

Remote DOM code can run on either side of a connection: host receivers and renderers run on the main thread, while remote authoring code and polyfills can run in an iframe or worker. Measuring those bundles separately makes it clearer which consumer is affected by a change.

The limits include regular dependencies but exclude framework peer dependencies supplied by the consuming application. They have 15% initial headroom, rounded up to 500-byte boundaries, so routine changes do not require constant budget updates.

Validation

  • pnpm install --frozen-lockfile
  • pnpm lint
  • pnpm type-check
  • pnpm test
  • pnpm size
  • pnpm size:why
  • Confirmed an intentionally tiny limit fails the command

No changeset is included because this only changes repository tooling, documentation, and CI.

@github-actions

Copy link
Copy Markdown
Contributor

We detected some changes in public packages, and there are no updates in the .changeset directory.
If the changes are user-facing and should cause a version bump, run pnpm changeset to track your changes and include them in the next release CHANGELOG.
If you are making simple updates to repo configuration, examples, or documentation, you do not need to add a changeset.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant