vicary
vicary•3w ago

How to build WASM from Rust?

Following MDN's WASM tutorial I've built a wasm that runs in the browser. Importing the generated wasm.js works fine, when I try to import the wasm_bg.wasm directly, it throws this error.
Uncaught TypeError: Relative import path "__wbindgen_placeholder__" not prefixed with / or ./ or ../
at async <anonymous>:1:51
Uncaught TypeError: Relative import path "__wbindgen_placeholder__" not prefixed with / or ./ or ../
at async <anonymous>:1:51
Not really understanding how bindgen works, but how do I build a Deno compatible WASM from Rust
No description
2 Replies
Doctor 🤖
Doctor 🤖•3w ago
I'm pretty sure the wasm.js file is meant to handle importing and setting up the wasm_bg.wasm file and creating the functions to interact with it.
vicary
vicaryOP•2w ago
That's what bindgen does, I am just curious the best way to compile Rust into a WASM for Deno's newly supported direct import.