跳转至

Wasm modules#

Stability: 1 - Experimental

Importing WebAssembly modules is supported under the --experimental-wasm-modules flag, allowing any .wasm files to be imported as normal modules while also supporting their module imports.

This integration is in line with the ES Module Integration Proposal for WebAssembly.

For example, an index.mjs containing:

1
2
import * as M from './module.wasm';
console.log(M);

executed under:

1
node --experimental-wasm-modules index.mjs

would provide the exports interface for the instantiation of module.wasm.