Right now, the docs to use WASM components from JS are fairly long: https://component-model.bytecodealliance.org/language-support/importing-and-reusing-components/javascript.html#using-jco-transpile-to-run-components-from-javsacript
I wanted to make something easier for people to use, so I created two custom loaders:
With these plugins, users can simply do the following:
import { add } from "./components/foo.wasm";
console.log("1 + 2 = " + add(1n, 2n));
Of course, it's not necessarily ideal to depend on external loaders, so I created issues on Bun and Deno asking them to enshrine this loader (probably not worth asking nodejs for anything):
Right now, the docs to use WASM components from JS are fairly long: https://component-model.bytecodealliance.org/language-support/importing-and-reusing-components/javascript.html#using-jco-transpile-to-run-components-from-javsacript
I wanted to make something easier for people to use, so I created two custom loaders:
With these plugins, users can simply do the following:
Of course, it's not necessarily ideal to depend on external loaders, so I created issues on Bun and Deno asking them to enshrine this loader (probably not worth asking nodejs for anything):