koute / cargo-web

A Cargo subcommand for the client-side Web

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cargo web build ignores dependency features

bxabi opened this issue · comments

commented

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?

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!