Like @cafce25 said RUSTFLAGS='--cfg getrandom_backend="wasm_js"' trunk serve
in the CLI works.
But, if you're tired of doing it the whole time and just want to use trunk serve
(and also make it easier for other people working on your project), I'd recommend to add a cargo config.
Create a .cargo
directory with config.toml
inside with:
[target.wasm32-unknown-unknown]
rustflags = ["--cfg", "getrandom_backend=\"wasm_js\""]