worker-build

Crates.ioworker-build
lib.rsworker-build
version0.7.4
created_at2021-09-02 16:28:20.300929+00
updated_at2026-01-15 20:37:04.024524+00
descriptionThis is a tool to be used as a custom build command for a Cloudflare Workers `workers-rs` project.
homepage
repositoryhttps://github.com/cloudflare/workers-rs/tree/main/worker-build
max_upload_size
id446061
size176,514
Dan Lapid (danlapid)

documentation

README

worker-build

This is a tool to be used as a custom build command for a Cloudflare Workers project.

# wrangler.toml
# ...

[build]
command = "cargo install -q worker-build && worker-build --release"

[build.upload]
dir    = "build/worker"
format = "modules"
main   = "./shim.mjs"

[[build.upload.rules]]
globs = ["**/*.wasm"]
type  = "CompiledWasm"

Environment Variables

You can override the default binary lookup/download behavior by setting these environment variables:

  • WASM_BINDGEN_BIN: Path to a custom wasm-bindgen binary. When set, worker-build will use this binary instead of downloading or looking for a globally installed version.

  • WASM_OPT_BIN: Path to a custom wasm-opt binary. When set, worker-build will use this binary instead of downloading one.

Example

export WASM_BINDGEN_BIN=/path/to/custom/wasm-bindgen
export WASM_OPT_BIN=/path/to/custom/wasm-opt
worker-build --release
Commit count: 814

cargo fmt