Skip to main content
Deploy your Worker to Cloudflare’s global network.
wrangler deploy [script] [options]

Arguments

script
string
The path to an entry point for your Worker

Options

Basic Options

--name
string
Name of the Worker
--compatibility-date
string
Date to use for compatibility checks
--compatibility-flags
string[]
Flags to use for compatibility checksAlias: --compatibility-flag
--latest
boolean
Use the latest version of the Workers runtimeDefault: false
--assets
string
Static assets to be served. Replaces Workers Sites.

Build Options

--no-bundle
boolean
Skip internal build steps and directly deploy WorkerDefault: false
--outdir
string
Output directory for the bundled Worker
--outfile
string
Output file for the bundled worker
--minify
boolean
Minify the Worker
--jsx-factory
string
The function that is called for each JSX element
--jsx-fragment
string
The function that is called for each JSX fragment
--tsconfig
string
Path to a custom tsconfig.json file
--metafile
string | boolean
Path to output build metadata from esbuild. If flag is used without a path, defaults to ‘bundle-meta.json’ inside the directory specified by —outdir.

Routing Options

--routes
string[]
Routes to uploadAlias: --route
--domains
string[]
Custom domains to deploy toAlias: --domain

Environment Options

--var
string[]
A key-value pair to be injected into the script as a variable
--define
string[]
A key-value pair to be substituted in the script
--alias
string[]
A module pair to be substituted in the script
--keep-vars
boolean
When not used (or set to false), Wrangler will delete all vars before setting those found in the Wrangler configuration. When used (and set to true), the environment variables are not deleted before the deployment. If you set variables via the dashboard you probably want to use this flag. Note that secrets are never deleted by deployments.Default: false

Trigger Options

--triggers
string[]
Cron schedules to attachAlias: --schedule, --schedules

Deployment Options

--dry-run
boolean
Don’t actually deploy
--logpush
boolean
Send Trace Events from this Worker to Workers Logpush. This will not configure a corresponding Logpush job automatically.
--upload-source-maps
boolean
Include source maps when uploading this Worker
--old-asset-ttl
number
Expire old assets in given seconds rather than immediate deletion
--dispatch-namespace
string
Name of a dispatch namespace to deploy the Worker to (Workers for Platforms)

Version Control Options

--tag
string
A tag for this Worker Version
--message
string
A descriptive message for this Worker Version and Deployment

Advanced Options

--strict
boolean
Enables strict mode for the deploy command, this prevents deployments to occur when there are even small potential risksDefault: false
--experimental-autoconfig
boolean
Experimental: Enables framework detection and automatic configuration when deployingDefault: trueAlias: --x-autoconfig
--containers-rollout
string
Rollout strategy for Containers changes. If set to immediate, it will override rollout_percentage_steps if configured and roll out to 100% of instances in one step.Choices: immediate, gradual

Examples

Deploy using configuration file

wrangler deploy

Deploy with specific entry point

wrangler deploy src/index.ts

Deploy with a custom name

wrangler deploy --name my-worker

Deploy to a specific route

wrangler deploy --route "example.com/*"

Deploy with environment variables

wrangler deploy --var API_KEY:secret123 --var ENV:production

Deploy with a version tag and message

wrangler deploy --tag v1.2.3 --message "Fix critical bug in auth flow"

Dry run deployment

wrangler deploy --dry-run

Deploy with source maps

wrangler deploy --upload-source-maps

Deploy to custom domain

wrangler deploy --domain my-app.com

Deploy static assets only

wrangler deploy --assets ./public

Deployment Workflow

  1. Build: Wrangler bundles your Worker code and dependencies
  2. Upload: The bundled code is uploaded to Cloudflare
  3. Publish: The Worker is deployed to Cloudflare’s global network
  4. Verify: Routes and triggers are configured

Version Control

Use --tag and --message to track deployments:
wrangler deploy --tag v2.0.0 --message "Major version release with new API"
This helps you identify and rollback to specific versions if needed.

Environment Variables

By default, Wrangler deletes all existing variables before setting new ones. Use --keep-vars to preserve variables set via the dashboard:
wrangler deploy --keep-vars

Build docs developers (and LLMs) love