Skip to content
This repository was archived by the owner on Nov 15, 2022. It is now read-only.

Creates a WebAssembly Instance. Not more, not less.

License

Notifications You must be signed in to change notification settings

calimoto-GmbH/simple-wasm-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple WASM loader

This package is a simple zero-dependency .wasm loader for webpack. It's bundling your WebAssembly file buffers as strings into your code and returns an async function which returns a WebAssembly.Instance.

Install

npm install -S simple-wasm-loader

How to use

Just add this to your webpack.config.js:

{
    test: /\.wasm$/,
    type: 'javascript/auto',
    loaders: ["simple-wasm-loader"]
}

And then you can import .wasm files:

import squarer from "./squarer.wasm";

(async () => {
    const instance = await squarer();
    console.log(instance.exports._Z7squareri(5)); // 25
})();

Why not use wasm-loader?

You can still use wasm-loader, but simple-wasm-loader just creates a WebAssembly Instance. Not more, not less.

About

Creates a WebAssembly Instance. Not more, not less.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published