Warning
This post was published 113 days ago. The information described in this article may have changed.
If I enable the feature tonic-build/transport
in WASM, I get a build error in the generated code.
When I not enable it in other targets, I also get a build error.
I wasn't able to find a way to make it work in both without modifying Cargo.toml for any of these configurations.
Below code snipped was supposed to get this done, but it doesn't.
Only if I comment out "transport" # why is this added with wasm?
I get a successful build
[target.'cfg(not(target_family = "wasm"))'.build-dependencies]
tonic-build = { workspace = true, default-features = false, features = [
"prost",
"transport" # why is this added with wasm?
]}
[target.'cfg(target_family = "wasm")'.build-dependencies]
tonic-build = { workspace = true, default-features = false, features = [
"prost",
]}
Build command:
cargo check --no-default-features --target wasm32-wasip2 --features A,B
Cargo seems to use all listed tonic-build
features independent of the section they are listed in.
Are there ways to get this working?
2 posts - 2 participants
🏷️ rust_feed