Closed tqwewe closed 7 months ago
Thanks for bringing this to our attention!
I'm not very familiar with WASI - my understanding is that with your proposed change, when running under WASI the crate should be using the Rust stdlib which will itself do the work of using the WASI-exposed syscalls?
Yep exactly right! wasm-bindgen is for web browsers, so it gives some issues when compiling to wasm32-wasi which is meant to be used on the server side only with something like wasmtime.
I've submitted the fix for this in https://github.com/mongodb/bson-rust/pull/442.
Describe the bug
js-sys
brings inwasm-bindgen
when targetingwasm32
architechture. However,wasm32-wasi
targets should not use js-sys not wasm-bindgen.The cargo toml should be updated to be something like
[target.'cfg(target_arch = "wasm32", target_os = "unknown")'.dependencies]
forjs-sys
.This causes issues when compiling to wasm components, as when trying to convert a crate which uses wasm-bindgen to a wasm component results in the following error: