Registry / web-framework / wasm-inliner

wasm-inliner

JSON →
library1.0.0jsnpmunverified

Zero-config WASM to inline JS bundler. Version 1.0.0 converts a .wasm file into a standalone JavaScript file embedding the binary as Base64, eliminating the need for fetch, CORS headers, or separate hosting. Suitable for both browser and Node.js environments, it provides a simple init function to instantiate the module. Released as a CLI tool and library, it targets small WASM modules and prioritizes simplicity over complex build integration. Differentiates from full build systems like webpack/wasm-pack by being a single-purpose, no-config utility.

npm install wasm-inliner
INSTALL
IMPORT
SIG · WASM-INLINER
W
wasm-inliner
web-frameworkjavascriptv1.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

initWasm
import initWasm from './your-file.bundle.js';
const initWasm = require('./your-file.bundle.js');
Generated bundle exports a default async function. CJS require may work but is not officially supported; use ESM imports for browser compatibility.
cli (bin)
node bin/cli.js your-file.wasm
wasm-inliner your-file.wasm
CLI is accessed via npx or global install; if not installed globally, run the script directly from the package.

Shows how to import the generated bundle and initialize the WASM module with a simple demo function call.

const initWasm = (await import('./your-file.bundle.js')).default; const instance = await initWasm(); console.log(instance.add(5, 10));
wasm-inliner --version
Debug
Known issues
gotchaGenerated bundle wraps WASM as Base64; large files increase JS size significantly.
fix
Only use for small WASM modules (<1MB). For larger files, prefer streaming compilation.
affects: <=1.0.0
gotchaThe generated bundle initializes WASM synchronously within the async init function, which may block the main thread if the WASM is large.
fix
Ensure initWasm() is called early and consider using Web Workers for heavy modules.
affects: <=1.0.0
gotchaThis tool does not handle WASM imports (e.g., environment, memory) beyond basic WASI stub. Complex WASM modules may fail.
fix
Pre-process your WASM to use simple exports/imports, or use a more comprehensive bundler like wasm-pack.
affects: <=1.0.0
Errors
Common errors & fixes
SyntaxError: Cannot use import statement outside a module
The generated bundle uses ESM syntax but is loaded in a non-module script or CommonJS context.
fix
Add type="module" to your script tag, or use dynamic import() in Node.
Error: WebAssembly.instantiate(): expected magic word 00 61 73 6d
The .wasm file is corrupted or not a valid WebAssembly binary.
fix
Verify the .wasm file is correct and re-run the inliner on it.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
10 hits · last 30 days
node
8
OpenAI (training)
2
Resources
wasm-inliner — npm install wasm-inliner · libregistry