Closed rcarcasses closed 2 years ago
Dependencies look fine. Can you share your github repository?
Or if you want a real world working example of tonic-web-wasm-client
, you can refer to this: https://github.com/devashishdxt/stag.
Hey @devashishdxt thanks for your quick reply, appreciated! Let me study your https://github.com/devashishdxt/stag repo first, I'll come back after.
Hi @devashishdxt, thanks again for your support. After inspecting your shared repo I found what was causing the problem on my side: basically the line:
[target.'cfg(not(target_arch = "wasm32"))'.build-dependencies]
tonic-build = "0.7"
caused the issue. The thing is, at build time, even if we are targeting wasm
, target_arch wasn't equal to wasm32
but to my local arch in fact. The solution is to turn on/off the needed features as it is done in your shared repo.
Hi, thanks for sharing your hard work. I'm trying to compile/generate tonic's code with the transport feature disabled but no success so far. Concretely I have modified my
Cargo.toml
to conditionally compile the protos according to the target:With this
cargo build
runs (I have abuild.rs
with some little configuration as expected), but when I try to target wasm withcargo build --lib --target wasm32-unknown-unknown
it fails miserably.Can you provide some hint please? Appreciated!