Turn a
.wasmfile into a single JavaScript file — no fetch, no CORS.
A small utility I built to solve a simple problem:
Using WebAssembly in the browser can be annoying when you just want something to work without dealing with hosting, CORS, or MIME types.
This tool takes a .wasm file and bundles it into a single JS file you can import directly.
Sometimes you don't want to:
- host a separate
.wasmfile - deal with CORS errors
- configure a server just to load a small module
So instead:
→ bundle it into JS and run it anywhere
npm install -g wasm-inlinernode bin/cli.js your-file.wasmThis will generate:
your-file.bundle.jsimport initWasm from './your-file.bundle.js';
const instance = await initWasm();
console.log(instance.add(5, 10));- embeds .wasm as Base64
- initializes it for you
- works in browser and Node
- best suited for small WASM files
- complex data handling depends on your WASM setup
This is a small, simple tool — not a full build system.
If it helps you avoid a bit of setup or debugging, that's enough 🙂
MIT