← Main

wasmbuild - Deno blog post

by David Sherret

I recently wrote a post on Deno's blog which introduces a tool my coworkers and I wrote called wasmbuild.

Check it out here: https://deno.com/blog/wasmbuild

Additional Points

With this tool, we have:

  1. Removed a lot of duplicate Rust -> Wasm build scripts.
    • Each Rust repo we had using Wasm was copy and pasting a build script. For example, look at the old _build.ts file that was previously in the deno_emit repo.
    • Some repos were doing it differently so processes were inconsistent. Everything is now aligned well enough.
  2. Reduced our contribution setup instructions.
    • Previously we had to tell people to globally install wasm-bindgen-cli and wasm-opt as well as run rustup target add wasm32-unknown-unknown. Now they only need Rust's toolchain and Deno installed.
    • We had a lot of issues with the global wasm-bindgen-cli being out of sync with the repo leading to cryptic errors.
      • wasmbuild ensures the version of wasm-bindgen used in the repo is the same one used by the tool internally.
  3. Added the ability to easily verify the build output committed to the Repo is up to date.
    • We run wasmbuild with the --check flag on the CI.
    • Previously we would often forget to build the Wasm code.
    • We did have this check in deno_std's repo, but it was shell code that required running the build on Linux. Now we just add a --check flag to the task that runs wasmbuild, which is much simpler. The change for this was made in this PR.

Anyway, check out the blog post for more details.

P.S. This tool would not be as easily possible without the amazing work done by the wasm-bindgen contributors. Wasmbuild uses wasm-bindgen-cli-support under the hood via Wasm so wasm-bindgen-cli doesn't need to be downloaded or installed.