rand 0.8 depends on getrandom 0.2, which refuses to compile on
wasm32-unknown-unknown without its "js" feature (it needs to call into the
Web Crypto API via wasm-bindgen). Bevy's own rand usage sits on getrandom
0.3+, which enables this by default, so the web build only broke once we
added a direct rand 0.8 dep in 76be513.
Force-enabling getrandom/js in the wasm32 target deps section unblocks
`trunk build`. Desktop is unaffected (the cfg gates it to wasm only).
Caught by the Task 8 wasm cargo-check gate.
ChaCha8Rng needs both crates: rand (the core traits Rng/SeedableRng) and
rand_chacha (the ChaCha8Rng type, split out of rand since 0.9). rand was
already a transitive dep via bevy_math but not declared directly.
Pinned to 0.8/0.3 (LTS, API-stable with the Bevy 0.19 ecosystem) rather
than the newer 0.10 line, which would force a wider dep upgrade.
The renderer is GPU-bound, but Bevy's CPU path (resource management,
system scheduling, egui, wgpu command submission) still benefits from
cross-crate inlining. Cargo's default release profile skips LTO and
splits codegen across 16 units, leaving inter-crate trampolines through
Bevy/wgpu in the hot path.
- lto = "fat": whole-program cross-crate inlining.
- codegen-units = 1: best optimization (slower compiles, accepted).
- panic = "abort": smaller binary, no unwind tables.
- strip = "symbols": drop debug symbols from the shipped binary.
wasm-release inherits release then overrides opt-level to "z", so web
builds keep their size focus. Release build verified; cargo test green
(14 passed).