Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wasm-inliner 🚀

Turn a .wasm file 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.


Why?

Sometimes you don't want to:

  • host a separate .wasm file
  • deal with CORS errors
  • configure a server just to load a small module

So instead:

→ bundle it into JS and run it anywhere


Installation

npm install -g wasm-inliner

Usage

node bin/cli.js your-file.wasm

This will generate:

your-file.bundle.js

Integration

import initWasm from './your-file.bundle.js';

const instance = await initWasm();

console.log(instance.add(5, 10));

What it does

  • embeds .wasm as Base64
  • initializes it for you
  • works in browser and Node

Limitations

  • best suited for small WASM files
  • complex data handling depends on your WASM setup

Notes

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 🙂

License

MIT

About

Convert your .wasm files into an inline JavaScript bundle using base64.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages