# worker-build This is a tool to be used as a custom build command for a Cloudflare Workers project. ```toml # 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 ```bash export WASM_BINDGEN_BIN=/path/to/custom/wasm-bindgen export WASM_OPT_BIN=/path/to/custom/wasm-opt worker-build --release ```