I'm running into an issue where I have a cargo workspace that needs to configure dependency versions based on a feature flag.
When configured for next_13
, I need the following dependencies:
swc_core = { version = "0.43.13", features = ["plugin_transform", "__ecma"]}
When configured for next_12, I need the following dependencies:
swc_common = { version = "0.28.10", features = ["concurrent"] }
swc_core = { version = "0.22.0", features = [
"plugin_transform",
"ecma_utils",
"ecma_visit",
"ecma_ast",
"common",
] }
swc_plugin_macro = {version="=0.9.8"}
Critically, I need swc_plugin_macro
to be precisely 0.9.8 when the next_12
feature flag is set, because an incompatibility with swc_core@0.22.0
. The rub is that swc_core@44
requires swc_plugin_macro@^0.9.9
Somehow, I need to be able to specify / exclude that precise package dependency. But no matter what I try, I get
failed to select a version for
swc_plugin_macro
... required by packageswc_core v0.43.13
... which satisfies dependencyswc_core_next_13 = "^0.43.13"
Before needing to support multiple versions of the same package, I had the swc libraries declared in the in the virtual manifest. I've tried the following to no avail:
- renaming packages in the virtual manifest, declaring them as optional dependencies in crates
- creating a next_12 and next_13 crate, that import the dependencies required for each, removing the dependencies from the virtual manifest, and depending on them directly from other crates
- duplicating an entire lib that specifies
next_12
dependencies instead of the dependencies declared in the virtual manifest
Surely it must be possible to have two versions of the same lib in the same workspace, with a precise dependency only when one of the versions is required. Can anyone help?
Thanks!