Skip to content

Turbopack: add experimental React compiler support#94573

Merged
wbinnssmith merged 3 commits into
canaryfrom
wbinnssmith/react-compiler
Jun 15, 2026
Merged

Turbopack: add experimental React compiler support#94573
wbinnssmith merged 3 commits into
canaryfrom
wbinnssmith/react-compiler

Conversation

@wbinnssmith

@wbinnssmith wbinnssmith commented Jun 8, 2026

Copy link
Copy Markdown
Member
  • Adds experimental.rustReactCompiler config option to the next.js config to opt in. It should be used alongside config.reactCompiler and errors if not set.
  • Only runs the compiler on client code (and SSR), not RSC
  • When enabled, runs the compiler directly on Turbopack's swc AST with no gen+reparse. This required passing through the original source text into source transforms.

@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Tests Passed

Commit: da112af

@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Stats cancelled

Commit: da112af
View workflow run

@wbinnssmith wbinnssmith force-pushed the wbinnssmith/react-compiler branch from aa6d39f to 547b417 Compare June 8, 2026 23:33
@wbinnssmith wbinnssmith force-pushed the wbinnssmith/vendor-react-compiler-swc branch from 49766a3 to 12d0ede Compare June 8, 2026 23:33
@wbinnssmith wbinnssmith force-pushed the wbinnssmith/react-compiler branch from 547b417 to 672ead6 Compare June 8, 2026 23:38
@wbinnssmith wbinnssmith force-pushed the wbinnssmith/vendor-react-compiler-swc branch from 12d0ede to d8c4122 Compare June 8, 2026 23:40
@wbinnssmith wbinnssmith force-pushed the wbinnssmith/react-compiler branch from 672ead6 to 6ddfd08 Compare June 8, 2026 23:40
Comment thread test/e2e/react-compiler/react-compiler.test.ts Outdated
@wbinnssmith wbinnssmith force-pushed the wbinnssmith/react-compiler branch from 6ddfd08 to 407f868 Compare June 9, 2026 00:03
@wbinnssmith wbinnssmith force-pushed the wbinnssmith/vendor-react-compiler-swc branch from d8c4122 to f670421 Compare June 9, 2026 00:03
@wbinnssmith wbinnssmith force-pushed the wbinnssmith/react-compiler branch 3 times, most recently from 854dd70 to a3652cc Compare June 9, 2026 00:30
@wbinnssmith wbinnssmith requested review from lukesandberg and sokra June 9, 2026 00:38
@wbinnssmith wbinnssmith marked this pull request as ready for review June 9, 2026 00:38

@vercel vercel Bot 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.

Additional Suggestion:

For non-TS (.js/.jsx) files using decorators, the decorators transform runs BEFORE ReactCompilerRust in the ecma preprocess chain, contradicting the documented invariant that ReactCompilerRust must run first against the original source.

Fix on Vercel

@wbinnssmith wbinnssmith force-pushed the wbinnssmith/vendor-react-compiler-swc branch from f670421 to c36493b Compare June 9, 2026 00:42
@wbinnssmith wbinnssmith force-pushed the wbinnssmith/react-compiler branch 2 times, most recently from c12fcbc to ff7b5a8 Compare June 9, 2026 00:47
@wbinnssmith wbinnssmith force-pushed the wbinnssmith/vendor-react-compiler-swc branch 2 times, most recently from b1d4322 to 432795e Compare June 9, 2026 00:53
@wbinnssmith wbinnssmith force-pushed the wbinnssmith/react-compiler branch 2 times, most recently from e246166 to 9488ad1 Compare June 12, 2026 02:35
@wbinnssmith wbinnssmith changed the base branch from wbinnssmith/vendor-react-compiler-swc to canary June 12, 2026 02:39
@wbinnssmith wbinnssmith force-pushed the wbinnssmith/react-compiler branch 4 times, most recently from 51e492e to daea470 Compare June 12, 2026 18:25
Comment thread turbopack/crates/turbopack-tests/tests/react_compiler.rs Outdated
Comment thread packages/next/src/server/config-shared.ts Outdated
Comment thread crates/next-core/src/next_config.rs Outdated
Comment thread crates/next-core/src/next_config.rs Outdated
Comment thread turbopack/crates/turbopack-ecmascript/src/transform/mod.rs Outdated
@wbinnssmith wbinnssmith force-pushed the wbinnssmith/react-compiler branch 5 times, most recently from 4789c14 to e57e52f Compare June 12, 2026 21:24
@wbinnssmith wbinnssmith requested a review from bgw June 12, 2026 21:37
- Adds experimental.rustReactCompiler config option to the next.js config to opt in. It should be used alongside `config.reactCompiler` and errors if not set.
- Only runs the compiler on client code
- When enabled, runs the compiler directly on Turbopack's swc AST with no gen+reparse
@wbinnssmith wbinnssmith force-pushed the wbinnssmith/react-compiler branch from e57e52f to 061fe2d Compare June 12, 2026 21:45
@wbinnssmith wbinnssmith merged commit 77f02f8 into canary Jun 15, 2026
222 of 226 checks passed
@wbinnssmith wbinnssmith deleted the wbinnssmith/react-compiler branch June 15, 2026 22:31
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.

3 participants