Load WASM components based on nodejs customization hooks (custom loaders)
npm install --save-dev node-wasm-component-loaderIf you have a file index.ts that uses a WASM component (ex: import { add } from "./adder.wasm")
You can register your custom hook (custom loader) when calling node as follows:
node --import node-wasm-component-loader ./index.ts- This only works for ESM (
type: module) - Custom loaders (hooks) are still experimental in nodejs
npm installnpm publish