-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Migrate to swc_core #9131
Migrate to swc_core #9131
Conversation
Using `swc_ecmascript` etc directly is deprecated and the recommendation is to migrate to swc_core instead as a meta-pacakge. This change makes that migration - it's mostly a case of updating a lot of imports, but also as a side-effect of bumping a few versions of SWC to pick up bugfixes there were some deprecated fields where code changes were needed. One major change with the latest SWC is that it currently requires Rust nightly to build. I've updated the `rust-toolchain` to reflect this, but I'm not sure if there are any broader implications.
8f2005a
to
467e9b2
Compare
This ensures correct tools are available in GH actions.
467e9b2
to
d009ad6
Compare
@@ -15,6 +15,10 @@ jobs: | |||
with: | |||
cache: yarn | |||
- uses: actions-rs/toolchain@v1 | |||
with: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried using the rust-toolchain
file support in this action for handling this, but couldn't get it working (in particular, this action doesn't support the modern TOML format - it hasn't been updated for years).
@@ -1,4 +1,5 @@ | |||
[workspace] | |||
resolver = "2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What was the reason for adding this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without this, you get this warning when building the JS Transformer:
warning: some crates are on edition 2021 which defaults to `resolver = "2"`, but virtual workspaces default to `resolver = "1"`
note: to keep the current resolver, specify `workspace.resolver = "1"` in the workspace root's manifest
note: to use the edition 2021 resolver, specify `workspace.resolver = "2"` in the workspace root's manifest
From reading the docs, if everything is building with the 2021 resolver then it's all good.
↪️ Pull Request
I wanted to pull in the fix for swc-project/swc#7582, but it didn't appear to be published in the
swc_ecmascript
minor version we were using. Bumping the minor version to latest caused some other compilation issues, so I decided to yakshave..Using
swc_ecmascript
etc directly is deprecated and the recommendation is to migrate toswc_core
instead as a meta-pacakge that's semver stable.This change makes that migration - it's mostly a case of updating a lot of imports, but also as a side-effect of bumping a few versions of SWC to pick up bugfixes there were some deprecated fields where code changes were needed.
One major change with the latest SWC is that it currently requires Rust nightly to build. I've updated the
rust-toolchain
to reflect this, but I'm not sure if there are any broader implications.