-
Notifications
You must be signed in to change notification settings - Fork 58
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
Add swcImplementation option #206
base: main
Are you sure you want to change the base?
Conversation
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'm not quite sure we need a new option for this. Like you mentioned, overrides should do the trick, but for the linked issue comment case, they could bundle the Vite plugin and specify their own SWC version? Is it common for SWC to break stuff too?
Yeah it broke multiple multiple times in last year, their rust plugin API is not as stable as their transformer. |
I'm still not sure if we need a new option since overrides should usually solve this, even if it breaks a lot. Exposing an implementation option feels odd to me. Maybe I'll see sapphi's thoughts on this then and if we're in favour of a new option, we could go with it. |
If the SWC plugin (e.g. @swc/plugin-emotion) requires a specific version of SWC, the plugin should have a peerDep field that declares that. But they introduce breaking changes even in patch versions and that makes it difficult to do that. If they did breaking changes only in minors, the plugins can have peerDep field and that would show warnings when installed. Maybe worth asking the SWC team if they are open to that. If not, I think we can have this option until the plugin API is stable. The pugin API seems to be an experimental feature and would be resolved when it becomes stable (swc-project/swc#5060). Bundling the plugin-react-swc plugin has a downside of locking version. I guess they want to lock the SWC and SWC plugins version since their versioning policy violates semver, but not to lock the plugin-react-swc plugin. |
Addressing: #190 (comment)
The other case it would be useful is when people have issues with breaking changes in the plugin API and want use another version of SWC. Ideally it should be done via package manager, but it very different from one case to another so I could have a generic message like:
Use your package manager overrides to install v1.X.X or add
"@swc/core": "1.X.X"
to your package.json and use