cargo-web icon indicating copy to clipboard operation
cargo-web copied to clipboard

cargo web build ignores dependency features

Open bxabi opened this issue 5 years ago • 1 comments

In my Cargo.toml, I have: reqwest = {version="0.10.1", features = ["blocking", "json"]}

In the Visual Studio Code, compilation is fine, it is not showing errors in my code. But when I run with cargo web, I get: no method named jsonfound for typereqwest::wasm::response::Response`

It seems that cargo web only compiles the default feature, not the additional ones. How can I add those?

bxabi avatar Jan 16 '20 11:01 bxabi

I have the exact same issue. I am trying to use a blocking http request which requires the blocking feature from the reqwest library.

In my Cargo.toml I have: reqwest = { version = "0.10.4", features = ["json", "blocking"] }

But I still get the following error:

let client = reqwest::blocking::Client::new();
                      ^^^^^^^^ could not find `blocking` in `reqwest`

Any help would be greatly appreciated!

Kai-Bailey avatar Apr 12 '20 18:04 Kai-Bailey