component-docs
component-docs copied to clipboard
Possibly recommend loaders to simplify docs
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):
- Bun: https://github.com/oven-sh/bun/issues/24867
- Deno (although Deno doesn't support custom loaders at the moment in the first place): https://github.com/denoland/deno/issues/31314