📦 your favorite rust -> wasm workflow tool!
  • Rust 98.4%
  • JavaScript 1.6%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Guy Bedford 1d35e8fe12
Some checks failed
Build and deploy documentation book / Build and deploy book (push) Has been cancelled
Tests / Test (push) Has been cancelled
Tests / Test-1 (push) Has been cancelled
Tests / Test-2 (push) Has been cancelled
fix(wasm64): fix tier-3 target handling and bump binaryen to v129 (#1586)
Resolves #1576.

Building for wasm64-unknown-unknown failed in two ways introduced by
#1553:

1. `rustup target add wasm64-unknown-unknown` failed because wasm64 is
   a tier-3 target with no prebuilt artifacts. Users had to work around
   this with `--mode force`.
2. The bundled wasm-opt (binaryen v117) could not parse 64-bit tables;
   support landed in binaryen v118.

The cargo target triple — declared in `.cargo/config.toml`,
`CARGO_BUILD_TARGET`, or as an extra cargo argument
(`-- --target wasm64-unknown-unknown`) — is the source of truth for
what wasm-pack builds. The target triple resolver now follows the same
precedence cargo uses (CLI > env > `.cargo/config.toml` walk-up >
`$CARGO_HOME/config.toml` > default), so wasm-pack and cargo always
agree on the target.

For tier-3 wasm targets (currently the `wasm64-*` family) wasm-pack
stays out of the cargo invocation — it does not inject `+nightly` or
`-Z build-std` (those would override a project's `rust-toolchain.toml`
pin or surprise users who hadn't intended a nightly build). Instead it:

* verifies the active toolchain is nightly, with a helpful error
  pointing at `rust-toolchain.toml` and `[unstable] build-std` in
  `.cargo/config.toml` if it isn't,
* installs the `rust-src` component for the active toolchain via
  rustup if missing,
* skips the `rustup target add` attempt (which always fails for tier-3
  targets),
* passes `--enable-memory64` to wasm-opt so the optimiser accepts
  64-bit memories and tables.

The bundled binaryen is bumped from `version_117` to `version_129`
(latest stable) so wasm-opt accepts 64-bit memories and tables.

`--panic-unwind` is untouched.

Tests:

* New unit test `build::tests::tier3_wasm_detection` covers the
  triple-classification helper.
* New `command::build::tests` unit tests cover the cargo-config
  walk-up resolution.
* New `wasm_opt_prebuilt_url_is_pinned_version` test guards against
  regressing the binaryen version below v118 (the first release with
  64-bit table support).
* Existing `all_latest_tool_download_urls_valid` validates the v129
  release URLs across all supported architectures.
2026-05-22 16:07:05 -07:00
.github chore(ci): Add crates.io trusted publishing to release workflow (#1582) 2026-05-15 21:04:27 +02:00
docs fix(wasm64): fix tier-3 target handling and bump binaryen to v129 (#1586) 2026-05-22 16:07:05 -07:00
npm 0.15.0 (#1580) 2026-05-15 10:22:43 +02:00
src fix(wasm64): fix tier-3 target handling and bump binaryen to v129 (#1586) 2026-05-22 16:07:05 -07:00
tests/all fix(wasm64): fix tier-3 target handling and bump binaryen to v129 (#1586) 2026-05-22 16:07:05 -07:00
wasm-pack-template Move wasm-pack template into repo (#1573) 2026-04-28 10:24:47 -07:00
.gitignore Replace curl with ureq 2023-05-30 18:26:31 +05:00
Cargo.lock fix(wasm64): fix tier-3 target handling and bump binaryen to v129 (#1586) 2026-05-22 16:07:05 -07:00
Cargo.toml fix(wasm64): fix tier-3 target handling and bump binaryen to v129 (#1586) 2026-05-22 16:07:05 -07:00
CHANGELOG.md fix(install): use prebuilt wasm-bindgen binary on macOS aarch64 (#1585) 2026-05-22 14:38:34 -07:00
clippy.toml Refactor: fix clippy warnings 2019-01-17 07:52:12 -06:00
CODE_OF_CONDUCT.md feat(coc): add rust coc 2018-04-18 11:06:38 -04:00
CONTRIBUTING.md Document prerequisites for webdriver tests 2025-07-20 20:21:30 -07:00
demo.gif v0.5.0 2018-09-24 21:07:30 -04:00
LICENSE-APACHE feat(doc): add licenses 2018-02-13 14:53:28 -05:00
LICENSE-MIT feat(doc): add licenses 2018-02-13 14:53:28 -05:00
README.md typo: s/drager/wasm-bindgen/ in URLs (#1571) 2026-04-27 16:08:35 -07:00
RELEASE_CHECKLIST.md Adds npm steps to release checklist 2020-01-27 11:20:20 -06:00

📦 wasm-pack

Your favorite Rust → Wasm workflow tool!

Build Status crates.io

Docs | Contributing | Chat

About

This tool seeks to be a one-stop shop for building and working with rust- generated WebAssembly that you would like to interop with JavaScript, in the browser or with Node.js. wasm-pack helps you build rust-generated WebAssembly packages that you could publish to the npm registry, or otherwise use alongside any javascript packages in workflows that you already use, such as webpack.

demo

🔮 Prerequisites

This project requires Rust 1.30.0 or later.

Quickstart Guide

Visit the quickstart guide in our documentation.

🎙️ Commands

  • new: Generate a new RustWasm project using a template
  • build: Generate an npm wasm pkg from a rustwasm crate
  • test: Run browser tests
  • pack and publish: Create a tarball of your rustwasm pkg and/or publish to a registry

📝 Logging

wasm-pack uses env_logger to produce logs when wasm-pack runs.

To configure your log level, use the RUST_LOG environment variable. For example:

RUST_LOG=info wasm-pack build

👯 Contributing

Read our guide on getting up and running for developing wasm-pack, and check out our contribution policy.

🤹‍♀️ Governance

This project was started by ashleygwilliams and is maintained by drager.