backoff icon indicating copy to clipboard operation
backoff copied to clipboard

getrandom requires js future

Open ycuk opened this issue 3 years ago • 0 comments

I try to use dependency backoff = { version = "0.4.0", futures = ["wasm-bindgen"] }

error: the wasm32-unknown-unknown target is not supported by default, you may need to enable the "js" feature. For more information see: https://docs.rs/getrandom/#webassembly-support
   --> /Users/ycuk/.cargo/registry/src/github.com-1ecc6299db9ec823/getrandom-0.2.3/src/lib.rs:219:9
    |
219 | /         compile_error!("the wasm32-unknown-unknown target is not supported by \
220 | |                         default, you may need to enable the \"js\" feature. \
221 | |                         For more information see: \
222 | |                         https://docs.rs/getrandom/#webassembly-support");
    | |_________________________________________________________________________^

error[E0433]: failed to resolve: use of undeclared crate or module `imp`
   --> /Users/ycuk/.cargo/registry/src/github.com-1ecc6299db9ec823/getrandom-0.2.3/src/lib.rs:246:5
    |
246 |     imp::getrandom_inner(dest)
    |     ^^^ use of undeclared crate or module `imp`

After clone repo and replace, it works well:

-getrandom = "0.2"
+getrandom = { version = "0.2", features = ["js"] }

ycuk avatar Dec 20 '21 07:12 ycuk