Skip to content

Conversation

@GiveMe-A-Name
Copy link
Member

Summary

We are introducing a recommendation to use @swc/react-compiler for pre-compilation to reduce the number of files processed by babel-loader, which is known to add significant compilation time.

Related links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@netlify
Copy link

netlify bot commented Jun 27, 2025

Deploy Preview for rspack ready!

Name Link
🔨 Latest commit 2ffb916
🔍 Latest deploy log https://app.netlify.com/projects/rspack/deploys/685e5384aafe740008853a74
😎 Deploy Preview https://deploy-preview-10823--rspack.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

@GiveMe-A-Name GiveMe-A-Name requested review from chenjiahan and Copilot and removed request for chenjiahan June 27, 2025 08:09
@github-actions github-actions bot added the release: document release: document related release(mr only) label Jun 27, 2025

This comment was marked as resolved.

{
// Must be run before 'builtin:swc-loader' to ensure that the file is processed by the React Compiler
// So we add it to the beginning of the rule
test: (resouce) => /\.jsx$/.test(resouce) && isReactCompilerRequiredSync(fs.readFileSync(resouce)),
Copy link
Member

Choose a reason for hiding this comment

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

I'm curious about the performance impact of readFileSync , can we do a performance comparison test to verify the performance difference between @swc/react-compiler and the previous babel-loader?

Copy link
Member Author

Choose a reason for hiding this comment

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

Got it, i will check it later

@github-actions github-actions bot added the team The issue/pr is created by the member of Rspack. label Jun 27, 2025
@suguanYang
Copy link

Just out of curiosity, are we already use @swc/react-compiler to use the react-compiler compling on jsx files? or only use the isReactCompilerRequired to skip some files as we still use babel to ReactCompiler?

I was looking for use react-compiler with swc, but the links leads me here. 😀

@chenjiahan
Copy link
Member

Currently @swc/react-compiler only provides the isReactCompilerRequired method to skip some files, and React Compiler still depends on running Babel (ref).

Unfortunately, in our early tests, isReactCompilerRequired did not bring significant performance improvements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release: document release: document related release(mr only) team The issue/pr is created by the member of Rspack.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants