Skip to content
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

Merged
merged 3 commits into from Jul 16, 2023

Conversation

marcins
Copy link
Contributor

@marcins marcins commented Jul 13, 2023

↪️ 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 to swc_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.

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.
@marcins marcins force-pushed the mszczepanski/migrate-to-swc-core branch 2 times, most recently from 8f2005a to 467e9b2 Compare July 13, 2023 00:52
This ensures correct tools are available in GH actions.
@marcins marcins force-pushed the mszczepanski/migrate-to-swc-core branch from 467e9b2 to d009ad6 Compare July 13, 2023 01:01
@@ -15,6 +15,10 @@ jobs:
with:
cache: yarn
- uses: actions-rs/toolchain@v1
with:
Copy link
Contributor Author

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"
Copy link
Member

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?

Copy link
Contributor Author

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.

@alshdavid alshdavid merged commit 631d280 into parcel-bundler:v2 Jul 16, 2023
7 of 15 checks passed
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.

None yet

3 participants