Open 71 opened 6 months ago
EDIT: the reason why I filed this issue is that I could not build swc
on macOS due to iconv
not being found, which appears to be a Nix problem, not a swc
problem. This issue is still valid (in that, disabling stacker
cannot be done when using swc_core
or swc_ecma_transforms_base
), but less blocking on my end.
I tried to add a disable_stacker
feature to swc_ecma_parser
, so if any dependent sets that feature we can avoid stacker
with a cfg(not(feature = "disable_stack"))
. This works at the source-code level.
Unfortunately, by keeping stacker
as a dependency (which seems inevitable; Cargo allows adding dependencies based on a feature, but not removing dependencies based on them), we still need to build that crate, and therefore the dependency on stacker
remains.
I see two other possible approaches:
stacker
from default features. Easy, but may not be the best for users which expect it to be there.swc
which depend on swc_ecma_parser
to avoid the default dependency on stacker
.
swc_core/ecma_parser
enable stacker
by default and provide swc_core/ecma_parser_no_stacker
to disable default features?
Describe the feature
7719 requested for
stacker
to be made an optional dependency, and #7720 implemented it.Unfortunately, Cargo features are additive so importing any package which depends on
swc_ecma_parser
and does not setdefault-features = false
(such asswc_core
andswc_ecma_transforms_base
) will enable default features inswc_ecma_parser
, and thus importstacker
as a dependency.Maybe my Cargo-fu is failing me, but AFAIK there is no workaround for this with
[patch]
and whatnot.Babel plugin or link to the feature description
No response
Additional context
No response