Wasm 模块
¥Wasm modules
稳定性: 1 - 实验性的
¥Stability: 1 - Experimental
在 --experimental-wasm-modules
标志下支持导入 WebAssembly 模块,允许将任何 .wasm
文件作为普通模块导入,同时也支持它们的模块导入。
¥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.
这种整合是符合 WebAssembly 的 ES 模块集成提案 的。
¥This integration is in line with the ES Module Integration Proposal for WebAssembly.
例如,index.mjs
包含:
¥For example, an index.mjs
containing:
import * as M from './module.wasm';
console.log(M);
在以下条件下执行:
¥executed under:
node --experimental-wasm-modules index.mjs
将为 module.wasm
的实例化提供导出接口。
¥would provide the exports interface for the instantiation of module.wasm
.