Cloudflare Docs
Edit this page
Report an issue with this page
Log into the Cloudflare dashboard
Set theme to dark (⇧+D)

Custom builds

Custom builds are a way for you to customize how your code is compiled, before being processed by Wrangler.

​​ Configure custom builds

Custom builds are configured by adding a [build] section in your wrangler.toml, and using the following options for configuring your custom build.

  • command string optional

    • The command used to build your Worker. On Linux and macOS, the command is executed in the sh shell and the cmd shell for Windows. The && and || shell operators may be used. This command will be run as part of wrangler dev and npx wrangler deploy.
  • cwd string optional

    • The directory in which the command is executed.
  • watch_dir string | string[] optional

    • The directory to watch for changes while using wrangler dev. Defaults to the current working directory.


command = "npm run build"
cwd = "build_cwd"
watch_dir = "build_watch_dir"