-
Notifications
You must be signed in to change notification settings - Fork 67
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
SWC: Rust based compiler to replace babel #1451
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…i/macro / @lingui/core in preparation to move to swc.
🦋 Changeset detectedLatest commit: c305cdf The changes in this PR will be included in the next version bump. This PR includes changesets to release 49 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as outdated.
This comment was marked as outdated.
ErwinOtten
reviewed
May 10, 2022
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With this PR, GraphCommerce will be using the Rust based SWC compiler that will replace babel. With this GraphCommerce is embracing that Rust is the future of javascript.
SWC was released as part of Next.js v12 and has been stabilizing in the last few months. With the v12.1.1 release it came with experimental support for emotion css, so it is time to switch over.
With this PR we're also doing away with any dependencies on babel-plugin-macros which isn't really maintained anymore.
This means we can't use @lingui/macro anymore. This is a bit of a downside, but we found upgrading not too difficult and we migrated the complete codebase in a few hours. And we have to migrate at some point anyways.
We are however very excited about the results of the SWC compiler!
Dev timings:
next dev
+babel
: 71,4s secondsnext dev
+swc
: 22,7 secondsOn a warm start (after next dev has run once) it is even faster: 6,1 seconds
Build times:
next build
+babel
: 8m 12snext build
+swc
: 4m 57sModern preset:
We're using a little trick to also force next.js/SWC into a 'modern' mode, this means we don't compile down to ES5, but down to a much more recent version:
The above change isn't officially supported by next.js, but it seems to be working absolutely fine for us. You can apply the patch to your own project with the excellent patch-package