-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
Consider replacing Babel with SWC #8060
Comments
Did some peeking here. Looks like it works pretty well out of the box but you could not get 100% of the current feature set that create-react-app has today with the current state of SWC.
|
|
@theKashey swc-project/swc#537 I think they do have that. https://swc-project.github.io/docs/preset-env#mode
|
I would love to be able to change the Typescript transpiler/compiler to swc when installing Create React App, or have it as default. 👍 Also, is there an easy way to make the switch myself and change what transpiler is targeted by the react scripts? |
@MrEmanuel I created a craco plugin craco-swc to let you use swc without having to eject. I also created craco-esbuild to tests both tools. I found that esbuild is faster as we can also replace the terser minifier with it. If you want to read more I wrote a small blog post sharing the benchmark I got https://dev.to/pradel/boost-your-create-react-app-workflow-with-esbuild-swc-3a8m. |
support svg react vue & more... https://github.com/efoxTeam/emp/blob/main/projects/swc-react-demo/README.md |
Or integrate something like Vite. It is starting to feel like CRA is lacking behind in this department. |
I'm considering support for using babel plugins by adding some APIs like But it's not trivial work, so I'd like to know if you are interested in switching to swc if it supports babel plugin. |
Both Snowpack 3.0 and Vite 2.0 went with ESBuild. |
You can fork and maintain your version of react-scripts. |
Swc-loader has improved a lot over the last couple of months, any interest in making this finally happen? |
It did indeed.
Having said this in the past I should add now that SWC is now used by Deno, being adopted by Next.js, and aims high with full TypeScript support, Babel replacement, a bundler (spack), and one day maybe even a TypeScript checker (stc). Their own benchmarks also seem to outperform ESBuild today (transforms only, haven't seen spack benchmarks yet). |
I recently replaced
That's 7110ms ... to 28ms. |
Create react app needs swc instead of babel. |
Any thoughts on this from the maintainers' side? Is that something you guys are currently considering/experimenting with? As SWC has matured a lot, it might good to get your insights and what would be missing for it to make its way to CRA |
@fbarbare CRA is in maintenance mode so I doubt it will ever be implemented. |
Hey React maintainers, big fan 🎊 This issue seems to be quite informative, what's your opinion on integrating ESBuild/SWC into CRA? |
Transpilation feels like the number one bottleneck for my productivity in large React projects. In some projects, I have to wait for half a minute to see the code changes in my browser. Luckily, some clever developers are working on SWC, the "Speedy Web Compiler". It basically replaces Babel, and it's crazy fast: 16 to 40 times faster, according to their own benchmarks.
SWC can be used with webpack and it supports pretty much all of the most important features (JSX, Typescript, source maps, legacy ES).
Maybe the project is not mature enough to fully replace Babel, but I think it makes sense to put it on the radar.
The text was updated successfully, but these errors were encountered: