Setting features for Cargo through environment variables?

I have a project that is built using wasm-pack, and, unlike cargo there is no way to set feature flags using its cli (something like --features X).

So, is there a way to set feature flags for cargo via environment variables?

Also it's undesirable to set the feature X as a default one.

Thanks.

$ wasm-pack build --help
...
Usage: wasm-pack build [OPTIONS] [PATH] [EXTRA_OPTIONS]...

Arguments:
  [PATH]              The path to the Rust crate. If not set, searches up the path from the current directory
  [EXTRA_OPTIONS]...  List of extra options to pass to `cargo build`

wasm-pack build -- --features X should work.

1 Like

How silly of me...

Thanks a lot :sweat_smile::sweat_smile::sweat_smile::sweat_smile:

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.