Skip to content

Commit

Permalink
Enable building for Web Assembly target
Browse files Browse the repository at this point in the history
The `rand` crate won't build properly for the
`wasm32-unknown-unknown` target unless we also depend
directly on the `getrandom` crate and enable its `js` feature.

References:
* rust-random/rand#886
* https://docs.rs/getrandom/0.2/getrandom/#webassembly-support
  • Loading branch information
rhymu8354 committed Mar 10, 2021
1 parent 75e0936 commit 21a355c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ log = "0.4"
rand = "0.8"
serde = { version = "1.0", features = ["derive"] }

[target.'cfg(target_arch = "wasm32")'.dependencies]
getrandom = { version = "0.2", features = ["js"] }

[dev-dependencies]
maplit = "1.0"
simple_logger = "1.11"
Expand Down

0 comments on commit 21a355c

Please sign in to comment.