fastrand
fastrand copied to clipboard
instant needs wasm-bindgen outside of dev
In Cargo.toml, you have these lines of "code"
`[target.'cfg(target_arch = "wasm32")'.dependencies] instant = "0.1"
[target.'cfg(target_arch = "wasm32")'.dev-dependencies] instant = { version = "0.1", features = ["wasm-bindgen"] } wasm-bindgen-test = "0.3" getrandom = { version = "0.2", features = ["js"] }`
If I'm using wasm-bingen and fastrand, and I'm not using a dev-dependcy profile, the compiled wasm simply won't work (more info here).
I fixed it by adding instant = {version="*", features=["wasm-bindgen"]}
to my Cargo.toml file, but if it's possible, I think your Cargo.toml file should be modified in a way so I don't have to do this
This is semi-intentional because we cannot deduce which JavaScript interface is in use from the target name alone (see also getrandom's doc).