You can use a locally-built version of workerd with Wrangler for developing Cloudflare Workers.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/cloudflare/workerd/llms.txt
Use this file to discover all available pages before exploring further.
Why use a local build?
Using a local workerd build with Wrangler allows you to:- Test new workerd features before they’re released
- Debug workerd runtime issues
- Contribute to workerd development
- Validate fixes for runtime bugs
Prerequisites
Build workerd
First, build workerd from source:The binary will be at
bazel-bin/src/workerd/server/workerd.Configuration
Set theMINIFLARE_WORKERD_PATH environment variable to point to your local workerd binary:
Running Wrangler with local workerd
Once configured, use Wrangler commands normally:Verifying the setup
Check that Wrangler is using your local build:Development workflow
Example: Testing a Worker
Create a simple Worker project:Testing compatibility flags
You can test new compatibility flags or features:wrangler.toml
Debugging with Wrangler
Combine Wrangler with workerd debugging features:--inspect, you can connect Chrome DevTools at chrome://inspect.
Troubleshooting
Wrangler not using local workerd
Wrangler not using local workerd
Verify the environment variable is set:Ensure the path points to the correct binary (not a directory).
Permission denied errors
Permission denied errors
Make sure the workerd binary is executable:
Version mismatch warnings
Version mismatch warnings
If you see compatibility warnings, your local workerd may be significantly different from the version Wrangler expects. This is usually safe for development but may cause unexpected behavior.
Binary not found
Binary not found
Double-check that you’ve built workerd:If the file doesn’t exist, run:
Using with watch mode
For active development, you can watch for changes and rebuild automatically:Advanced: Multiple workerd versions
You can maintain multiple workerd builds for different purposes:Running workerd directly
For cases where you don’t need Wrangler’s full features, you can run workerd directly:Next steps
Configuration
Learn about workerd configuration
Testing
Test your workerd changes