@hpcc-js/esbuild-plugins
TypeScript icon, indicating that this package has built-in type declarations

1.4.1 • Public • Published

esbuild-plugin-sfx-wasm

Installation

With npm:

npm i -D esbuild-plugin-sfx-wasm

Use-cases

The primary motivation for this plugin is to simplify the bundling and distribution of web assembly modules

  • Compresses the wasm module using Zstd
  • Encodes the compressed wasm module as a base91 string
  • Generates a standalone module that decodes and instantiates the wasm module on demand

Usage

Build Config

import esbuild from "esbuild";
import sfxWasm from "esbuild-plugin-sfx-wasm";

esbuild.build({
  /* ... */
  plugins: [
    sfxWasm()
  ],
  /* ... */
});

Usage in your code

import loadCalculator from "../build/calculator.wasm";

async function add(a, b) {
  const calc = await loadCalculator();
  return calc.add(1, 2);
}

Package Sidebar

Install

npm i @hpcc-js/esbuild-plugins

Weekly Downloads

4

Version

1.4.1

License

Apache-2.0

Unpacked Size

57.8 kB

Total Files

25

Last publish

Collaborators

  • hpcc-js