Binaryen.js provides prebuilt browser and Node.js binaries of Binaryen, a compiler infrastructure and toolchain library for WebAssembly. Version 129.0.0 is the latest stable release; the project follows Binaryen releases closely. It optimizes Wasm modules, performs transformations (e.g., inlining, dead code elimination), and validates/parses Wasm. Key differentiators: it works entirely in JavaScript with no native dependencies, making it suitable for web build pipelines, and it supports both ESM and CommonJS. Compared to wasm-opt CLI, it enables programmatic Wasm optimization in Node.js or browser bundlers.
npm install binaryenNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a simple Wasm module with an 'add' function, validates, and emits binary.
Always await Binaryen.ready() at top of your script.
Use import syntax or upgrade to Node >=12.22 or use dynamic import().
Consider offloading to a Web Worker or use Async variants if available (currently no async API, but Binaryen.ready is async).
Check the type definition file (.d.ts) for completeness; use 'as any' if needed.
Add 'await Binaryen.ready();' before any other Binaryen calls.
Ensure Binaryen.ready() is called and awaited at the start of your async function.
Switch to 'import Binaryen from 'binaryen'' and use an ESM-compatible setup.
Ensure all function types, functions, and imports are added before exports.
No dependency data recorded yet.