You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The last version that compiles successfully for WASM is 0.9.0. Versions 0.10.0 and 1.0.0 produce a compilation error when compiling the getrandom dependency:
error: the wasm*-unknown-unknown targets are not supported by default, you may need to enable the "js" feature. For more information see: https://docs.rs/getrandom/#webassembly-support
--> /Users/romamik/.cargo/registry/src/index.crates.io-6f17d22bba15001f/getrandom-0.2.15/src/lib.rs:342:9
|
342 | / compile_error!("the wasm*-unknown-unknown targets are not supported by \
343 | | default, you may need to enable the \"js\" feature. \
344 | | For more information see: \
345 | | https://docs.rs/getrandom/#webassembly-support");
| |________________________________________________________________________^
Additionally, versions 0.8.0, 0.8.1, and 0.9.0 compile for WASM, but the generated JS contains an import of an unresolved module "env", similar to the issue described here: rustwasm/wasm-bindgen#1907
Thus, the last version that actually works for WASM is 0.7.0.
It looks like neither ahash nor ustr on Wasm do enable the js feature of getrandom. The reason behind the current state is explained in the linked url.
A work around is to add this dependency to your project using ustr on Wasm:
getrandom = { version = "0.2", features = ["js"] }
That way, getrandom has the js feature enabled.
Following the documentation in getrandom, I created a PR (#46) that disables the default features of ahash, which removes getrandom as a runtime dependency.
The last version that compiles successfully for WASM is 0.9.0. Versions 0.10.0 and 1.0.0 produce a compilation error when compiling the getrandom dependency:
Additionally, versions 0.8.0, 0.8.1, and 0.9.0 compile for WASM, but the generated JS contains an import of an unresolved module "env", similar to the issue described here: rustwasm/wasm-bindgen#1907
Thus, the last version that actually works for WASM is 0.7.0.
Here is some small project: foo.zip
To build for WASM run
wasm-pack build --target=web
.The text was updated successfully, but these errors were encountered: