Skip to content

refactor(react): use rolldown over rollup - #7300

Closed
joshblack wants to merge 7 commits into
mainfrom
refactor/update-react-to-rolldown
Closed

refactor(react): use rolldown over rollup#7300
joshblack wants to merge 7 commits into
mainfrom
refactor/update-react-to-rolldown

Conversation

@joshblack

Copy link
Copy Markdown
Member

Update @primer/react to use rolldown over rollup for improved build performance.

Changelog

New

Changed

  • Update rollup-plugin-import-css to be rolldown compatible
  • Update @primer/react to use rolldown over rollup for bundling

Removed

  • Remove build process from rollup-plugin-import-css since it is no longer necessary

Rollout strategy

  • None; if selected, include a brief description as to why

As far as I can tell, this should be a 1:1 replacement so no changeset needed but will use integration tests to confirm 🤞

CopilotAI review requested due to automatic review settings December 10, 2025 21:25
@joshblack
joshblack requested a review from a team as a code ownerDecember 10, 2025 21:25
@changeset-bot

changeset-botBot commented Dec 10, 2025

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 275fc52

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@joshblackjoshblack changed the title Refactor/update react to rolldownrefactor(react): use rolldown over rollupDec 10, 2025
@github-actionsgithub-actionsBot added the staff Author is a staff member label Dec 10, 2025
@github-actions

Copy link
Copy Markdown
Contributor

👋 Hi, this pull request contains changes to the source code that github/github-ui depends on. If you are GitHub staff, test these changes with github/github-ui using the integration workflow. Or, apply the integration-tests: skipped manually label to skip these checks.

@github-actionsgithub-actionsBot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Dec 10, 2025
@joshblackjoshblack added the skip changeset This change does not need a changelog label Dec 10, 2025

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request migrates the @primer/react build system from rollup to rolldown for improved build performance. The migration involves replacing the rollup-plugin-import-css package with a new rolldown-compatible version (rolldown-plugin-import-css) and updating the build configuration to use rolldown's API and plugin structure.

Key Changes

  • Replaced rollup bundler with rolldown for the @primer/react package build process
  • Created a new rolldown-plugin-import-css package to replace the rollup version, using rolldown's filter-based plugin API
  • Removed the build process from the plugin package (no longer compiles to dist, exports TypeScript source directly)

Reviewed changes

Copilot reviewed 10 out of 12 changed files in this pull request and generated 5 comments.

Show a summary per file
FileDescription
packages/rollup-plugin-import-css/tsconfig.build.jsonDeleted build-specific TypeScript configuration (no longer needed)
packages/rollup-plugin-import-css/src/index.tsDeleted old rollup plugin implementation
packages/rollup-plugin-import-css/rollup.config.jsDeleted rollup build configuration for the plugin
packages/rollup-plugin-import-css/package.jsonDeleted old plugin package definition
packages/rolldown-plugin-import-css/tsconfig.jsonAdded TypeScript configuration for new rolldown plugin
packages/rolldown-plugin-import-css/src/index.tsNew rolldown-compatible plugin using filter-based hooks
packages/rolldown-plugin-import-css/package.jsonNew package definition exporting TypeScript source directly
packages/rolldown-plugin-import-css/README.mdUpdated documentation to reference rolldown instead of rollup
packages/react/script/buildUpdated build script to use npx rolldown instead of npx rollup
packages/react/rolldown.config.mjsNew rolldown configuration replacing rollup config; removed node-resolve, commonjs, and preserve-directives plugins
packages/react/package.jsonAdded rolldown and rolldown-plugin-import-css dependencies, reordered @tanstack/react-virtual
package-lock.jsonUpdated dependencies to include rolldown bindings and related packages
Comments suppressed due to low confidence (3)

packages/react/rolldown.config.mjs:125

  • The previous rollup config included a custom "preserve-directives" plugin that prepended "use client" directives to output chunks when preserveModules was enabled. This plugin has been removed in the rolldown config, but there's no indication that rolldown handles this natively. Without this plugin, React Server Components may not work correctly as the "use client" directives from source files (like src/index.ts, src/experimental/index.ts, src/deprecated/index.ts, src/next/index.ts) won't be preserved in the built output. Verify that rolldown preserves module-level directives or add equivalent functionality.
    packages/react/rolldown.config.mjs:124
  • The rolldown configuration is missing the "interop" setting that was present in the rollup config output. The previous config specified interop: 'auto' which controls how default and named exports are handled when mixing ES modules and CommonJS. Without this setting, there may be compatibility issues when consuming this package from projects using different module systems. Consider adding interop configuration if rolldown supports it.
    packages/react/rolldown.config.mjs:100
  • The rollup config previously included @rollup/plugin-node-resolve and @rollup/plugin-commonjs plugins to handle module resolution and CommonJS dependencies. These plugins have been removed without replacement. While rolldown may have built-in support for these features, this should be explicitly verified. Without proper module resolution, imports may fail, especially for dependencies that use CommonJS format or non-standard module resolution patterns.

Comment threadpackages/rolldown-plugin-import-css/src/index.ts Outdated
Comment threadpackages/rolldown-plugin-import-css/src/index.ts Outdated
Comment threadpackages/rolldown-plugin-import-css/src/index.ts Outdated
Comment threadpackages/rolldown-plugin-import-css/src/index.ts Outdated
Comment threadpackages/rolldown-plugin-import-css/package.json
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@swiing

Copy link
Copy Markdown
Contributor

Since you are willing to replace rollup-plugin-import-css by a new rolldown-plugin-import-css, please complete the update:

  • rename workspace in ./package.json
  • update files in ./eslint.config.mjs

@swiing

Copy link
Copy Markdown
Contributor

You may also want to consider #7304, as also applicable to your PR.

@jonrohanjonrohan mentioned this pull request Dec 12, 2025
13 tasks
@primer-integration

Copy link
Copy Markdown

👋 Hi from github/github-ui! Your integration PR is ready: https://github.com/github/github-ui/pull/9523

@primer-integration

Copy link
Copy Markdown

🔬 github-ui Integration Test Results

CheckStatusDetails
CI✅ PassedView run
Projects (Memex)⏳ PendingWaiting for workflow to complete
VRT✅ PassedView run

@joshblack
joshblack deleted the refactor/update-react-to-rolldown branch January 2, 2026 21:26
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration-tests: recommendedThis change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpmskip changesetThis change does not need a changelogstaffAuthor is a staff member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@joshblack@swiing@siddharthkp