-
Notifications
You must be signed in to change notification settings - Fork 647
refactor: use rolldown for packages #7298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 6266921 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR migrates the build tooling for internal packages (doc-gen, mcp, and styled-react) from rollup to rolldown, a Rust-based bundler that provides improved build performance while maintaining rollup API compatibility. This is a follow-up to PR #7263, continuing the rolldown adoption strategy across the monorepo.
Key changes include:
- Replacing rollup with rolldown in build scripts and configurations
- Removing bundler plugins that rolldown handles natively (
@rollup/plugin-commonjs,@rollup/plugin-node-resolve,@rollup/plugin-json) - Adding explicit dependencies to
styled-reactthat were previously bundled
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/styled-react/script/build | Updates build script to use rolldown CLI instead of rollup |
| packages/styled-react/rollup.config.js | Deleted old rollup configuration including custom preserve-directives plugin |
| packages/styled-react/rolldown.config.js | New rolldown configuration with simplified plugin setup |
| packages/styled-react/package.json | Adds clsx, deepmerge, and focus-visible as dependencies; replaces rollup with rolldown in devDependencies |
| packages/mcp/rolldown.config.js | Migrates from rollup to rolldown, removes unnecessary plugins |
| packages/mcp/package.json | Updates build and watch scripts to use rolldown |
| packages/doc-gen/rolldown.config.js | Migrates from rollup to rolldown with platform: 'node' configuration |
| packages/doc-gen/package.json | Updates build scripts and reorders dependencies alphabetically |
| packages/doc-gen/tsconfig.json | Includes vitest.config.mts for IDE support |
| packages/doc-gen/tsconfig.build.json | Excludes test files from build output |
| package-lock.json | Updates dependencies with rolldown and related packages |
| .changeset/chatty-windows-grin.md | Documents the dependency additions to styled-react |
Comments suppressed due to low confidence (1)
packages/mcp/rolldown.config.js:16
- The doc-gen package config includes platform: 'node' (line 17), but this mcp config is missing it. Since mcp is also a Node.js package with a bin entry and uses Node.js APIs, it should also specify platform: 'node' to ensure rolldown properly handles Node.js built-ins and module resolution. Add platform: 'node' after the external property for consistency.
| @@ -0,0 +1,48 @@ | |||
| import babel from '@rollup/plugin-babel' | |||
| import {defineConfig} from 'rollup' | |||
Copilot
AI
Dec 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This import statement should use 'rolldown' instead of 'rollup'. The configuration file is named rolldown.config.js and the build scripts use the rolldown CLI, but defineConfig is being imported from the wrong package. This will cause the build to fail or use the wrong bundler configuration.
| import {defineConfig} from 'rollup' | |
| import {defineConfig} from 'rolldown' |
| plugins: [ | ||
| typescript({ | ||
| tsconfig: 'tsconfig.build.json', | ||
| }), | ||
| babel({ | ||
| presets: ['@babel/preset-typescript', ['@babel/preset-react', {runtime: 'automatic'}]], | ||
| plugins: ['babel-plugin-styled-components'], | ||
| extensions: ['.ts', '.tsx'], | ||
| babelHelpers: 'bundled', | ||
| }), | ||
| ], |
Copilot
AI
Dec 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The previous rollup configuration included a custom "preserve-directives" plugin that explicitly prepended "use client" directives to output chunks. This plugin has been removed in the rolldown migration. The source file src/index.tsx contains a 'use client' directive that needs to be preserved in the built output for React Server Components compatibility. While rolldown may handle directives natively (as it's rollup-compatible), this should be verified by inspecting the built dist/index.js file to ensure "use client" appears at the top of the output. If the directive is missing, a similar custom plugin may need to be added to the rolldown configuration.
Follow up to: #7263 but a little smaller 👀
This PR updates our internal packages and styled-react to use
rolldownoverrollup. Rolldown is a rollup API compatible library that is using Rust for improved build performance ✨Changelog
New
Changed
doc-genmcpstyled-reactstyled-react/package.jsonso they were external to the buildRemoved
Rollout strategy
For most libraries, this should be internal-only but
styled-reactI added a changeset for since we needed to add dependencies topackage.json