Add WASM-specific configurations
I've added a runner override to use the wasm-server-runner for easy devlopment -- it's a localhost webserver to provide the WASM binary & it's bootstrap code. There is also target-specific config related to the RNG back-end.
This commit is contained in:
4
.cargo/config.toml
Normal file
4
.cargo/config.toml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
[target.wasm32-unknown-unknown]
|
||||||
|
runner = "wasm-server-runner"
|
||||||
|
rustflags = ["--cfg", "getrandom_backend=\"wasm_js\""]
|
||||||
@@ -9,4 +9,9 @@ rand = "0.9.2"
|
|||||||
rand_chacha = "0.9.0"
|
rand_chacha = "0.9.0"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
dynamic_linking = ["bevy/dynamic_linking"]
|
dynamic_linking = ["bevy/dynamic_linking"]
|
||||||
|
|
||||||
|
# For WASM builds, we need to use the browser's RNG back-end.
|
||||||
|
# This also requires the extra rustflags in `.cargo/config.toml`
|
||||||
|
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||||
|
getrandom = { version = "0.3.3", features = ["wasm_js"] }
|
||||||
|
|||||||
Reference in New Issue
Block a user