Skip to content

Conversation

@sachinraja
Copy link
Contributor

@sachinraja sachinraja commented Jul 28, 2021

Feel free to close this PR if it is too experimental to use. It switches out babel for swc, a super-fast javascript compiler written in rust. Building the repo is 20x faster (123.29ms) compared to babel (2848ms). I realize this is a minimal difference, but it is still faster. SWC is applied to the test (@swc/jest) and script files (@swc/register) too.

Notes

@sachinraja sachinraja changed the title experiment: compile with swc compile with swc Jul 28, 2021
@ghost
Copy link

ghost commented Aug 27, 2021

Can you compare it to https://github.com/evanw/esbuild ?

@sachinraja
Copy link
Contributor Author

sachinraja commented Aug 27, 2021

I don't see the benefits of doing that. This project currently uses babel, which is a compiler, not a bundler. The way I see it is swc is like babel and esbuild is like webpack.

@reinink
Copy link
Member

reinink commented Sep 23, 2021

Hey we'd like to merge this, but the tests are currently failing because swc isn't maintaining the export order of our plugins (in corePlugins.js). If you can think of a solution for this and want to implement it, that would be great. Otherwise we'll get to this eventually and get it merged. Thanks for submitting this!

@sachinraja
Copy link
Contributor Author

sachinraja commented Sep 23, 2021

Are you sure? Looking at the CI errors, it seems like swc failed to install.

Just tried it and it seemed to be a combination of those errors. Installing the latest versions for swc resolved the script errors, but the tests are failing because of the export order.

I don't believe Node itself even guarantees that the order will be kept with a wildcard import (looks to be sorting alphabetically). I think the way to do it would be to have a more explicit ordering system.

@RobinMalfait
Copy link
Member

Hey! Thank you for your PR!
Much appreciated! 🙏

I had to rebase and bump some versions and had no push rights. That said, @sachinraja you are still marked as a contributor on the other PR I opened #5593.

Thank you for your initial work!

@sachinraja
Copy link
Contributor Author

Awesome, glad to see this merged!

@sachinraja sachinraja deleted the swc branch September 24, 2021 21:28
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