Conversation
🦋 Changeset detectedLatest commit: 15aebdb The changes in this PR will be included in the next version bump. This PR includes changesets to release 8 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
🟢 No design token changes found |
🟢 Bundle size report
|
|
🟢 No unit test coverage changes foundAll components and hooks with tests maintain the same coverage as the main branch. |
There was a problem hiding this comment.
Pull request overview
Adds an ESM build/output pathway for @primer/react-brand alongside the existing UMD build, plus CI/docs updates to support and validate the new distribution and bundle-size reporting.
Changes:
- Added a Vite-based ESM build (
packages/react/esm) with a new@primer/react-brand/esmexport path and corresponding TypeScript declarations. - Introduced bundle size checks (Size Limit + GitHub Action) and a script to generate a PR comment report.
- Updated Next.js integration tests and docs to exercise/describe UMD vs ESM consumption paths.
Reviewed changes
Copilot reviewed 23 out of 26 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/repo-configs/scripts/bundle-size-report.js | Generates PR comment output for Size Limit comparisons. |
| packages/react/vite.esm.config.ts | Adds Vite build config for the ESM output, including CSS module naming and CSS injection. |
| packages/react/tsconfig.esm.json | Emits ESM declaration files into esm/. |
| packages/react/src/index.esm.ts | Adds an ESM entry that re-exports the main index. |
| packages/react/src/css/stylesheets.ts | Adds a noop export intended to prevent global styles from being tree-shaken away. |
| packages/react/src/LogoSuite/LogoSuite.tsx | Switches play/pause icons to Octicons components. |
| packages/react/scripts/postbuild | Copies LICENSE into esm/ output. |
| packages/react/package.json | Adds exports map entries for /esm, adds ESM build script, and updates sideEffects/files. |
| packages/react/.gitignore | Ignores esm/ output. |
| packages/e2e/integration-tests/fixtures/index.umd.ts | Updates UMD fixture imports and ensures global CSS is loaded for UMD case. |
| packages/e2e/integration-tests/fixtures/index.esm.ts | Switches fixture imports to @primer/react-brand/esm. |
| packages/e2e/integration-tests/fixtures/KitchenSink.tsx | Removes global CSS import (now handled in the UMD fixture barrel). |
| package.json | Adds size script and Size Limit deps. |
| package-lock.json | Locks new dependencies (Size Limit, Vite-related, Octicons bump, etc.). |
| apps/next-docs/package.json | Bumps @primer/octicons-react. |
| apps/next-docs/next-env.d.ts | Changes Next route types reference (currently problematic). |
| apps/next-docs/content/** | Adds/adjusts docs navigation + new ESM getting-started guide. |
| .size-limit.js | Defines bundle-size checks for UMD and ESM (including tree-shaken cases). |
| .gitignore | Ignores esm/ output and adds an integration-test artifact ignore entry (currently mismatched). |
| .github/workflows/integration_test_nextjs.yml | Runs Next.js integration tests for both UMD and ESM setups via a matrix. |
| .github/workflows/bundle_size.yml | Adds PR-time bundle-size reporting workflow. |
| .changeset/free-planets-fold.md | Changeset describing the new ESM entry point and usage. |
You can also share your feedback on Copilot code review. Take the survey.
danielguillan
left a comment
There was a problem hiding this comment.
Great work! Just one minor fix in the changeset and a question regarding sideEffects.
|
|
||
| We recommend switching to ESM as soon as possible, as it will eventually become the default in future. | ||
|
|
||
| 🔗 [Get started with ESM](https://primer.style/brand/introduction/getting-started/esm) |
There was a problem hiding this comment.
| 🔗 [Get started with ESM](https://primer.style/brand/introduction/getting-started/esm) | |
| 🔗 [Get started with ESM](https://primer.style/brand/getting-started/esm) |
| "sideEffects": [ | ||
| "**/*.css", | ||
| "./esm/index.esm.js", | ||
| "./src/css/stylesheets.ts" |
There was a problem hiding this comment.
Should this use the compiled output path instead? I'm not sure how to verify this.

Summary
Towards https://github.com/github/brand-marketing-design/issues/2759
Adds an ESM entrypoint for
@primer/react-brandso that modern UI frameworks and bundlers can import Primer Brand components in a more efficient way.The previous UMD bundle and import mechanisms are still in-place and default. No breaking changes are proposed as part of this change.
The ESM bundles will allow users of the package to import only the components and styles they need, rather than the entire library. It also simplifies the way styles are loaded, which is now performed automatically.
Eventually ESM will become the default, and we will remove the UMD + Webpack legacy bundles. This will happen once we ship the v1 release of Primer Brand.
List of notable changes:
@primer/react-brand/esm, which users can opt-into.What should reviewers focus on?
Steps to test:
Supporting resources (related issues, external links, etc):
Contributor checklist:
update snapshotslabel to the PR)Reviewer checklist:
Screenshots:
New bundle size comment in PRs (scroll down to see the real version):