tonic icon indicating copy to clipboard operation
tonic copied to clipboard

allow turning off tonic_build transport feature for wasm target alone

Open borngraced opened this issue 2 years ago • 6 comments

this would be useful for using tonic with WASM

borngraced avatar Sep 28 '23 05:09 borngraced

Is this issue still relevant? Is using tonic while targeting wasm possible today?

tbmreza avatar Apr 11 '24 10:04 tbmreza

I disabled transport feature and implemented in my code no need to rely on tonic_build for it

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
tonic = { version = "0.7", features = ["tls", "tls-webpki-roots", "compression"] }

[target.'cfg(target_arch = "wasm32")'.dependencies]
tonic = { version = "0.7", default-features = false, features = ["prost", "codegen", "compression"] }

[build-dependencies]
tonic-build = { version = "0.7", default-features = false, features = ["prost", "compression"] }

borngraced avatar Apr 11 '24 14:04 borngraced

@borngraced Great that it works for you. I still have the problem, but thanks for the idea. 😀

tbmreza avatar Apr 11 '24 23:04 tbmreza

What's the problem?..be specific please

borngraced avatar Apr 11 '24 23:04 borngraced

It's a runtime error (cargo c and cargo build are green using your config values) that I haven't figured out what the cause is. I have tried dioxus and trunk, same results.

tbmreza avatar Apr 12 '24 01:04 tbmreza