You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using swc_core = "0.59.40" and its related crates, there are multiple compilation errors due to version conflicts between syn 1.x and syn 2.x. The errors manifest as type mismatches between similar types from different versions of syn.
syn::Attribute vs syn::attr::Attribute
syn::Fields vs syn::data::Fields
syn::DeriveInput vs syn::derive::DeriveInput
Punctuated<Lit, _> vs Punctuated<Lit, Comma>
Sample error messages:
mismatched types
syn::Attribute and syn::attr::Attribute have similar names, but are actually distinct types
perhaps two different versions of crate syn are being used?
Technical Details
The issue appears to stem from transitive dependencies using different versions of syn:
syn 1.0.109 types are being used in some places
syn 2.0.87 types are being used in others
This causes type mismatches in macros and type definitions, particularly in the ast_node-0.8.8 crate.
I### mpact
This version conflict prevents compilation of projects using these SWC components, making it impossible to build SWC plugins or tools depending on these versions.
Since I'm using the suggested swc_core version implied by : https://plugins.swc.rs/. It is a bit weird that it can't work by default?
Plus, the minimal nextjs version provided by the version selecting tool is 13.1.6. Does this implies that its impossible to work for lower version nextjs such as 12.2.5 or something like this?
Environment
Rust version: rustc 1.82.0
OS: macOS 14.5
Input code
No response
Config
No response
Playground link (or link to the minimal reproduction)
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
Describe the bug
When using swc_core = "0.59.40" and its related crates, there are multiple compilation errors due to version conflicts between syn 1.x and syn 2.x. The errors manifest as type mismatches between similar types from different versions of syn.
Reproduction
Using the following dependencies in Cargo.toml:
[workspace.dependencies]
swc_core = "0.59.40"
testing = "0.31.34"
swc_ecma_parser = "0.124.12"
Error Examples
Type conflicts between syn 1.x and syn 2.x:
syn::Attribute vs syn::attr::Attribute
syn::Fields vs syn::data::Fields
syn::DeriveInput vs syn::derive::DeriveInput
Punctuated<Lit, _> vs Punctuated<Lit, Comma>
Sample error messages:
mismatched types
syn::Attribute and syn::attr::Attribute have similar names, but are actually distinct types
perhaps two different versions of crate syn are being used?
Technical Details
The issue appears to stem from transitive dependencies using different versions of syn:
syn 1.0.109 types are being used in some places
syn 2.0.87 types are being used in others
This causes type mismatches in macros and type definitions, particularly in the ast_node-0.8.8 crate.
I### mpact
This version conflict prevents compilation of projects using these SWC components, making it impossible to build SWC plugins or tools depending on these versions.
Minimal Production
https://codesandbox.io/p/devbox/hf4g3g
Questions
Environment
Rust version: rustc 1.82.0
OS: macOS 14.5
Input code
No response
Config
No response
Playground link (or link to the minimal reproduction)
https://github.com/asde29873012549/swc_plugin_demo
SWC Info output
No response
Expected behavior
It should compile expectedly
Actual behavior
No response
Version
swc_core = "0.59.40"
Additional context
No response
The text was updated successfully, but these errors were encountered: