Skip to content

feat(transform): integrate the React Compiler as a transform option#9656

Draft
Boshen wants to merge 1 commit into
mainfrom
react-compiler
Draft

feat(transform): integrate the React Compiler as a transform option#9656
Boshen wants to merge 1 commit into
mainfrom
react-compiler

Conversation

@Boshen
Copy link
Copy Markdown
Member

@Boshen Boshen commented Jun 6, 2026

Runs the Rust port of the React Compiler (oxc-project/oxc#22942) at the pre-ecma-ast stage, gated by a new transform.reactCompiler option.

Changes

  • Pin the oxc crates to the integration PR via [patch.crates-io], and add the oxc_react_compiler git dependency.
  • Add react_compiler to the bundler transform options; run it on the pristine AST in pre_process_ecma_ast before the oxc transformer, returning the scoping the rest of the pipeline uses (mirrors how oxc::Compiler sequences it).
  • Expose it as reactCompiler?: boolean | ReactCompilerOptions through the napi binding (reusing oxc_transform_napi's resolver) and the TS types.
  • Snapshot integration test: crates/rolldown/tests/rolldown/topics/react_compiler/{basic,disabled} — enabled emits the react/compiler-runtime import + c(n) memo cache; disabled does not.

Usage

rolldown({ transform: { reactCompiler: true } })
rolldown({ transform: { reactCompiler: { compilationMode: "all" } } })

Notes

  • Draft: depends on feat(react_compiler): integrate the Rust port of the React Compiler oxc-project/oxc#22942. The [patch.crates-io] pins a git rev until that lands; swap to a released oxc version before merging.
  • The React Compiler's raw _c import alias is renamed by rolldown's scope-hoisting linker (to c / react_compiler_runtime.c), so the test asserts on the react/compiler-runtime import + memo cache rather than the literal _c( token.
  • A full napi build + JS smoke test has not been run yet (cargo --workspace check, clippy, fmt, tsc, and the Rust snapshot test all pass).

🤖 Generated with Claude Code

@netlify
Copy link
Copy Markdown

netlify Bot commented Jun 6, 2026

Deploy Preview for rolldown-rs ready!

Name Link
🔨 Latest commit 67ee4ac
🔍 Latest deploy log https://app.netlify.com/projects/rolldown-rs/deploys/6a23d1768e6f490007bb7081
😎 Deploy Preview https://deploy-preview-9656--rolldown-rs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Run the Rust port of the React Compiler (oxc-project/oxc#22942) at the
pre-ecma-ast stage, gated by a new `transform.reactCompiler` option.

- pin the oxc crates to the integration PR via [patch.crates-io], and add
  the oxc_react_compiler git dependency
- add `react_compiler` to the bundler transform options; run it on the
  pristine AST in pre_process_ecma_ast before the oxc transformer, returning
  the scoping the rest of the pipeline uses
- expose it as `reactCompiler?: boolean | ReactCompilerOptions` through the
  napi binding (reusing oxc_transform_napi's resolver) and the TS types
- add a snapshot integration test (enabled vs disabled)

Depends on oxc-project/oxc#22942; the patch pins a git rev until it lands.
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