Skip to content

Make @swc/core as a peer dependency #972

@ha1fstack

Description

@ha1fstack

Related plugins

Describe the bug

@swc/core doesn't follow semver but vite-plugin-react is using caret version.

This could silently break when plugin-react-swc is packaged together with swc plugins.

For example, @swc/core@1.13.5 is only compatible with @swc/plugin-emotion@^11
(https://plugins.swc.rs/versions/range/426)

but the caret ^1.13.5 installs latest version on fresh install which breaks plugin compatibility.

To fix this we have to override the version or modify the lockfile manually which is not a great experience.

There could be two options:

  • fix the version
  • make it as a peer dependency

I think latter one makes more sense since swc's javascript interface is mostly consistent.

Related code

https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc/package.json

Used Package Manager

yarn

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions