Hey, I've written a small module in rust and define the API in wit. I was wondering how this module can be instantiated in the browser, or how I would get the wasi_snapshot_preview1 imports for the module to use.
So the obvious solution that came to me after asking the question is that rather than compiling for wasm32-wasi, it's enough to compile it for target wasm32-unknown-unknown. This seems to work, but is there anything I'm missing here?
If you are using wasmtime SDK in the host, you should be able to add WASI to the linker like this:
wasmtime_wasi::add_to_linker(&mut linker, |s| s)?;, and then compile the module to wasm32-wasi and load into the host.
See more: https://docs.wasmtime.dev/examples-rust-wasi.html
Jens Gåsemyr Magnus has marked this topic as resolved.
Last updated: Jan 09 2026 at 13:15 UTC