wasm-pack

Build tool for compiling Rust to WebAssembly and publishing to npm. Handles wasm-bindgen glue code generation, TypeScript type definitions, and packaging for browser, Node.js, or bundler targets. The standard workflow for Rust → Wasm → npm: write Rust with #[wasm_bindgen] attributes, run wasm-pack build, publish the resulting npm package.

Evaluated Mar 06, 2026 (0d ago) v0.13+
Homepage ↗ Repo ↗ Developer Tools webassembly wasm rust npm build-tool browser node
⚙ Agent Friendliness
65
/ 100
Can an agent use this?
🔒 Security
88
/ 100
Is it safe for agents?
⚡ Reliability
78
/ 100
Does it work consistently?

Score Breakdown

⚙ Agent Friendliness

MCP Quality
--
Documentation
82
Error Messages
78
Auth Simplicity
95
Rate Limits
100

🔒 Security

TLS Enforcement
95
Auth Strength
85
Scope Granularity
80
Dep. Hygiene
88
Secret Handling
90

Rust memory safety. Wasm sandbox provides browser-side isolation. npm publishing uses standard npm security model. Open source and auditable.

⚡ Reliability

Uptime/SLA
78
Version Stability
80
Breaking Changes
75
Error Recovery
78
AF Security Reliability

Best When

You're writing Rust code that needs to run in browsers or Node.js with JavaScript interop via wasm-bindgen and npm distribution.

Avoid When

You don't have Rust code to compile — or you need server-side Wasm execution rather than browser/npm distribution.

Use Cases

  • Compile Rust libraries to WebAssembly npm packages that work in browser, Node.js, or bundled applications
  • Build high-performance compute-heavy functions in Rust (cryptography, image processing, parsing) that run at near-native speed in browsers
  • Create Rust-backed npm packages with TypeScript types auto-generated from wasm-bindgen annotations
  • Integrate existing Rust codebases into JavaScript/TypeScript projects via Wasm without rewriting in JS
  • Publish Wasm-powered npm packages to registries for distribution to web application developers

Not For

  • Non-Rust Wasm compilation — wasm-pack is Rust-specific; use Emscripten for C/C++ or TinyGo for Go
  • Server-side Wasm execution — wasm-pack targets browser/npm distribution; use wasmtime for server-side Wasm
  • Pure JavaScript projects that don't need native performance — the Rust + Wasm toolchain adds significant complexity

Interface

REST API
No
GraphQL
No
gRPC
No
MCP Server
No
SDK
No
Webhooks
No

Authentication

Methods: none
OAuth: No Scopes: No

No auth for build step. Publishing to npm uses npm credentials (npm login). Publishing to private registries uses their auth.

Pricing

Model: open_source
Free tier: Yes
Requires CC: No

MIT/Apache-2.0 dual licensed. Part of the Rust+Wasm working group. Completely free.

Agent Metadata

Pagination
none
Idempotent
Full
Retry Guidance
Not documented

Known Gotchas

  • wasm-pack requires Rust toolchain with wasm32-unknown-unknown target — run 'rustup target add wasm32-unknown-unknown' before first build
  • Build target (--target web|bundler|nodejs|no-modules) changes generated JS glue code significantly — choose target based on consumption environment
  • wasm-bindgen version must match wasm-pack's bundled version — mismatch causes cryptic errors; pin versions in Cargo.toml
  • Large Rust dependency trees can take minutes to compile on first run — CI caching of cargo registry and build artifacts is essential
  • Generated TypeScript types may need manual refinement for complex Rust types — review .d.ts output before publishing
  • wasm-pack publish uses npm credentials from .npmrc or npm login — separate authentication from build step in CI

Alternatives

Full Evaluation Report

Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for wasm-pack.

$99

Scores are editorial opinions as of 2026-03-06.

5215
Packages Evaluated
26151
Need Evaluation
173
Need Re-evaluation
Community Powered