An asynchronous .wasm file loader for esbuild that lets you import WebAssembly modules directly via import statements, following the WebAssembly/ES Module Integration proposal. Current stable version is 1.1.0. It supports two modes: 'deferred' (default, copies WASM binary to output and fetches at runtime) and 'embedded' (embeds as base64, increasing bundle size ~30%). Requires esbuild >=0.11.0 and Node >=10.0.0. Key differentiator: lightweight alternative to heavier bundler setups, but note that top-level await only works with 'esm' output format, not 'iife' or 'cjs'. Ships TypeScript definitions.
npm install esbuild-plugin-wasmVerified import paths — ran on the pinned version, not inferred.
Shows basic usage: set up esbuild with the wasm plugin in ESM mode, then import a .wasm file.
Set format: 'esm' in esbuild build options, or use deferred mode and ensure runtime supports fetch.
Deploy the .wasm file to the same directory as the output JS, or adjust paths with 'publicPath' or similar.
Use deferred mode for production, or compress WASM before embedding.
Switch to ESM import syntax (e.g., import wasm from './lib.wasm').
Set format: 'esm' in your esbuild config.
Add wasmLoader() to the plugins list.
Use esbuild with the wasmLoader plugin to bundle the .wasm file.
No dependency data recorded yet.