esbuild-plugin-wasm-pack is an esbuild plugin that runs wasm-pack before each build to compile Rust/Wasm crates. Version 1.1.0 is the latest stable release. It integrates esbuild with the wasm-pack toolchain, automatically generating WebAssembly modules during the bundling process. Key differentiators include seamless integration with esbuild's plugin system, TypeScript support via generated .d.ts files, and full configuration parity with wasm-pack build arguments. It requires Node.js >=0.10.0, esbuild >=0.11.15, Rust/Cargo, and wasm-pack to be installed. The plugin is actively maintained on GitHub and distributed via npm.
npm install esbuild-plugin-wasm-packNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates how to use esbuild-plugin-wasm-pack to build a Rust WebAssembly crate during an esbuild build.
Ensure wasm-pack is installed globally (e.g., cargo install wasm-pack) and verify with 'which wasm-pack' or set WASM_PACK_PATH environment variable.
Consider using wasm-pack programmatically or running it as a separate build step for large crates.
Use the functional import: import wasmpack from 'esbuild-plugin-wasm-pack' and call it as a function with options.
Use Node.js >=12 (or current LTS) to ensure compatibility with esbuild and modern JavaScript features.
Double-check the 'path' option points to a directory with a Cargo.toml file.
Install wasm-pack globally: 'cargo install wasm-pack'. Alternatively, set the 'wasmPackPath' option or WASM_PACK_PATH environment variable to the executable's path.
Use 'import wasmpack from "esbuild-plugin-wasm-pack"' (default import) or 'const wasmpack = require("esbuild-plugin-wasm-pack")'. Do not destructure.Check the Rust crate for compilation errors. Ensure all dependencies are present. Run 'wasm-pack build' in the crate directory to see detailed output.