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
- The command used to build your Worker. On Linux and macOS, the command is executed in the
sh
shell and thecmd
shell for Windows. The&&
and||
shell operators may be used. This command will be run as part ofwrangler dev
andnpx wrangler deploy
.
- The command used to build your Worker. On Linux and macOS, the command is executed in the
-
cwd
string
- The directory in which the command is executed.
-
watch_dir
string | string[]
- The directory to watch for changes while using
wrangler dev
. Defaults to the current working directory.
- The directory to watch for changes while using
Example:
wrangler.toml[build]
command = "npm run build"
cwd = "build_cwd"
watch_dir = "build_watch_dir"