When building my component with wasm-tools component new
, I get an error:
module requires an import interface named `__wbindgen_placeholder__`
This only occurs when I include a local crate as a dependency (and use it).
I'm not sure what part of this dependency is causing this issue, but the dependency itself has nothing to do with wasm, and is just a regular rust crate.
From digging into the code of wasm bindgen, it seems like __wbindgen_placeholder__
is supposed to get replaced with something, however in my case it isn't?
Sorry it doesn't work, here's the current output:
❯ wasm-tools component new ./target/wasm32-wasi/release/game.wasm -o ./modules/game.wasm --adapt ./../../../thalo-rs/thalo/crates/thalo_cli/wasi_snapshot_preview1.wasm
error: failed to encode a component from module
Caused by:
0: module requires an import interface named `__wbindgen_placeholder__`
This indicates that wasm bindgen is being used but that's not compatible with components so the only fix will be to figure out what's depending on wasm bindgen and to either update or remove that dependency
That's strange, it would make sense however when I do cargo tree -p game
or cargo tree -i wasm-bindgen
, it's not a dependency of the game
wasm component being generated.
It is a dependency used within the cargo workspace I'm in, but I don't think that should import wasm bindgen
I've just posted the output of running cargo tree -p game
Ah I forgot to do --target wasm32-wasi
when creating the tree! Looks like the bson
crate was the issue, using wasm-bindgen.
Ari Seyhun has marked this topic as resolved.
https://github.com/mongodb/bson-rust/issues/441
Last updated: Dec 23 2024 at 12:05 UTC