{ } qjs-modules

loaders/wasm

Source: lib/loaders/wasm.js (JS wrapper over registerHooks()) — default export: installWasmLoader(); qjsm only

Loads .wasm files as ES modules (format module-wasm), the instance phase of the WebAssembly ESM integration. Opt-in: nothing is registered until it is called.

import installWasmLoader from 'loaders/wasm';

installWasmLoader();
const { add } = await import('./add.wasm');
BehaviorDetail
Importseach wasm import module name is a specifier resolved like a JS import ("./env.js", "env") and evaluated first
Exportsevery export becomes a named export; a global export holds its value, memories, tables and functions are the wasm objects
Bytesread again from the file at evaluation; the .wasm URL must be a file: path
Not coveredimport source (engine lacks it), with { type: 'wasm' }

Exports

ExportKindDescription
installWasmLoader()functionRegisters the resolve/load hooks; returns the registerHooks() result (deregister()).(default export)