Skip to content

refactor(rspack): switch React Compiler examples to builtin:swc-loader - #2

Merged
heyq02 merged 2 commits into
mainfrom
cursor/react-compiler-swc-9462
Oct 13, 2026
Merged

heyq02 merged 2 commits into
mainfrom
cursor/react-compiler-swc-9462

Conversation

@heyq02

@heyq02 heyq02 commented Oct 13, 2026 •

Copy link
Copy Markdown
Owner

Summary

Addresses review feedback on #517 by migrating the React Compiler examples from Babel to Rspack's Rust React Compiler.

  • Enable jsc.transform.reactCompiler: true on a single builtin:swc-loader rule with detectSyntax: 'auto' and react.runtime: 'automatic'
  • Remove babel.config.js and Babel dependencies (babel-loader, babel-plugin-react-compiler, @babel/plugin-syntax-*)
  • Rename rspack/react-compiler-babel → rspack/react-compiler and rspack/react-compiler-babel-ts → rspack/react-compiler-ts
  • Keep useCounter.ts so the TypeScript example still shows hooks in .ts files being optimized

Follow-up (separate PR): update React Compiler example links in the Rspack docs (react-compiler-babel → react-compiler, etc.).

Test plan

  • pnpm --filter "@rspack-example/react-compiler" build
  • pnpm --filter "@rspack-example/react-compiler-ts" build
  • Dev bundle shows react/compiler-runtime memo cache for App and useCounter.ts
  • Smoke-test dev — counter button increments 0 → 3

Counter at 0
Counter at 3
react-compiler-ts-counter-smoke-2.mp4

To show artifacts inline, enable in settings.

Open in Web Open in Cursor 

cursoragent and others added 2 commits October 13, 2026 03:41
Use Rspack's Rust React Compiler via jsc.transform.reactCompiler instead
of babel-loader. Consolidate JS/TS/JSX/TSX into a single rule with
detectSyntax: 'auto', remove Babel config/deps, and rename examples to
react-compiler and react-compiler-ts.

Addresses review feedback on rstackjs#517.

Co-authored-by: Ari <mail@heyq02.cn>
Resolve leftover rebase conflict markers in react-compiler-ts and refresh
pnpm-lock.yaml after renaming the React Compiler examples.

Co-authored-by: Ari <mail@heyq02.cn>
@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0698a35b-6c4c-468e-a3d1-4e125a345fa3
📥 Commits

Reviewing files that changed from the base of the PR and between 2b458e6 and e3ba2cb.

⛔ Files ignored due to path filters (3)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • rspack/react-compiler-ts/src/logo.svg is excluded by !**/*.svg
  • rspack/react-compiler/src/logo.svg is excluded by !**/*.svg
📒 Files selected for processing (21)
  • rspack/react-compiler-babel-ts/babel.config.js
  • rspack/react-compiler-babel-ts/rspack.config.js
  • rspack/react-compiler-babel/babel.config.js
  • rspack/react-compiler-ts/index.html
  • rspack/react-compiler-ts/package.json
  • rspack/react-compiler-ts/rspack.config.js
  • rspack/react-compiler-ts/src/App.css
  • rspack/react-compiler-ts/src/App.tsx
  • rspack/react-compiler-ts/src/assets.d.ts
  • rspack/react-compiler-ts/src/env.d.ts
  • rspack/react-compiler-ts/src/index.css
  • rspack/react-compiler-ts/src/index.tsx
  • rspack/react-compiler-ts/src/useCounter.ts
  • rspack/react-compiler-ts/tsconfig.json
  • rspack/react-compiler/index.html
  • rspack/react-compiler/package.json
  • rspack/react-compiler/rspack.config.js
  • rspack/react-compiler/src/App.css
  • rspack/react-compiler/src/App.jsx
  • rspack/react-compiler/src/index.css
  • rspack/react-compiler/src/index.jsx
 ____________________________________
< Zero-day? Zero chance on my watch. >
 ------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@heyq02
heyq02 marked this pull request as ready for review October 13, 2026 04:43
@heyq02
heyq02 merged commit a13b4e5 into main Oct 13, 2026
1 check passed
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.

2 participants