Add wasm-specific feature for RNG child dependency
The `rand` crate eventually depends on `getrandom` which requires a different feature set when running in the browser. WASM has no OS, and so no RNG provider... but the browser, specifically, has one that the JavaScript runtime can touch. Enabling the "wasm_js" feature on `getrandom` allowes it to use this backend. An extra config option must *also* be passed to `rustc`. THis can be set through the environment, or the config.toml. I've chosen the latter so I don't need to think about it very often.
This commit is contained in:
3
.cargo/config.toml
Normal file
3
.cargo/config.toml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
|
||||||
|
[target.wasm32-unknown-unknown]
|
||||||
|
rustflags = ["--cfg", "getrandom_backend=\"wasm_js\""]
|
||||||
@@ -12,3 +12,6 @@ rand = "0.9.2"
|
|||||||
[features]
|
[features]
|
||||||
dynamic_linking = ["bevy/dynamic_linking"]
|
dynamic_linking = ["bevy/dynamic_linking"]
|
||||||
debug_ui = ["bevy_rapier2d/debug-render-2d"]
|
debug_ui = ["bevy_rapier2d/debug-render-2d"]
|
||||||
|
|
||||||
|
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||||
|
getrandom = { version = "0.3.3", features = ["wasm_js"] }
|
||||||
|
|||||||
Reference in New Issue
Block a user