Workers CLI Version Migration, Custom Builds, and Deprecations
How to install Wrangler, migrate across major CLI versions, replace deprecated commands and config, and verify your Workers project setup.
This page summarizes Cloudflare documentation on Wrangler, the command-line interface for Cloudflare Workers and related Developer Platform products. Most teams land here when upgrading an old project, fixing a failed deploy after a dependency bump, or replacing removed flags like wrangler publish or type = "webpack".
Wrangler is a command-line tool for building with Cloudflare developer products.
— Cloudflare, C3 & Wrangler
With Wrangler you can develop locally or remotely, deploy Workers, manage bindings (KV, D1, Queues, and others), and operate Pages projects. Commands run with the permissions of the authenticated member or API token; see Wrangler for roles and permissions.
Wrangler install and update: check which CLI version you use
Section titled “Wrangler install and update: check which CLI version you use”Cloudflare recommends installing Wrangler locally in the project (as a dev dependency) rather than globally, then invoking it through your package manager.
To see the version in your project:
npx wrangler --versionTo bump to the latest release in the project:
npm i -D wrangler@latestEquivalent commands for Yarn, pnpm, and Bun are listed in Install/Update Wrangler. After any major upgrade, run npx wrangler --version again and read CLI warnings during wrangler dev or wrangler deploy.
How to run Wrangler commands from package.json scripts
Section titled “How to run Wrangler commands from package.json scripts”Because the binary usually lives in node_modules, the invocation depends on the package manager:
npx wrangler deployyarn wrangler deploypnpm wrangler deployYou can pin common tasks in package.json:
{ "scripts": { "deploy": "wrangler deploy", "dev": "wrangler dev" }}Then run npm run deploy, yarn run deploy, or pnpm run deploy. The general form is documented in Commands:
wrangler <COMMAND> <SUBCOMMAND> [PARAMETERS] [OPTIONS]— Cloudflare, Commands
Migrate from Wrangler v1 to v2: webpack, publish, and global uninstall
Section titled “Migrate from Wrangler v1 to v2: webpack, publish, and global uninstall”Version 2 was a structural change: new configuration fields, local wrangler dev, and removal of several v1-only commands. The entry point is Migrate from Wrangler v1 to v2, which splits work into webpack migration and the version bump.
This document describes the steps to migrate a project from Wrangler v1 to Wrangler v2. Before updating your Wrangler version, review and complete Migrate webpack projects from Wrangler version 1 if it applies to your project.
— Cloudflare, Update to Wrangler v2
type = webpack and webpack_config: what to change in Wrangler v2
Section titled “type = webpack and webpack_config: what to change in Wrangler v2”Starting with Wrangler v2, the type and webpack_config keys in the Wrangler configuration file are no longer supported, but you can still use webpack externally:
Starting with Wrangler v2, Wrangler no longer supports the
typeandwebpack_configkeys, but you can still use webpack with your Workers.— Cloudflare, Migrate webpack projects
| How you used webpack in v1 | What to do for v2+ |
|---|---|
[build] / external bundler already runs webpack |
Keep [build]; Wrangler v2 still supports the [build] key |
type = webpack with Wrangler’s default config |
Remove type = webpack from the Wrangler file |
Custom webpack_config for file types or transforms |
Move bundling to your own pipeline; configure Custom builds with [build].command |
Wrangler v2 supports the
[build]key, so your Workers will continue to build using your own setup.— Cloudflare, Migrate webpack projects
Wrangler runs esbuild by default during dev and deploy unless a custom build step runs first:
Wrangler runs esbuild by default as part of the dev and deploy commands, and bundles your Worker project into a single Worker script.
— Cloudflare, Custom builds
Uninstall global Wrangler v1 before using Wrangler v2+
Section titled “Uninstall global Wrangler v1 before using Wrangler v2+”If v1 was installed globally:
npm uninstall -g @cloudflare/wranglercargo uninstall wranglerThe v2 CLI is intended to guide you through remaining configuration changes; compare v1 vs v2 behavior in Deprecations (command and configuration tables).
Migrate from Wrangler v2 to v3: dependency update only
Section titled “Migrate from Wrangler v2 to v3: dependency update only”For most projects, v2 → v3 is an in-place dependency update:
There are no special instructions for migrating from Wrangler v2 to v3. You should be able to update Wrangler by following the instructions in Install/Update Wrangler. You should experience no disruption to your workflow.
— Cloudflare, Migrate from Wrangler v2 to v3
Some commands and config fields were deprecated in v3 and removed in v4; if you stayed on v3 for a long time, plan replacements using the tables below before jumping to v4.
Migrate from Wrangler v3 to v4: Node.js, esbuild, and removed legacy options
Section titled “Migrate from Wrangler v3 to v4: Node.js, esbuild, and removed legacy options”Wrangler v4 is described as a smaller major release than v1→v2 or v2→v3 rewrites—many workflows continue unchanged:
Unlike previous major versions of Wrangler, which were foundational rewrites and rearchitectures — Version 4 of Wrangler includes a much smaller set of changes. If you use Wrangler today, your workflow is very unlikely to change.
— Cloudflare, Migrate from Wrangler v3 to v4
Upgrade inside the project:
npm i -D wrangler@4npx wrangler --versionCloudflare documents v3 support windows in Use the latest JavaScript features with Wrangler CLI v4: bug fixes and security updates for v3 until Q1 2026, critical security updates until Q1 2027.
Node.js support policy after Wrangler v4
Section titled “Node.js support policy after Wrangler v4”Wrangler v4 aligns with the Node.js project’s support lifecycle. Node.js v16 is no longer supported; the minimum for v4 is Node.js v18 or later (active, maintenance, and current releases):
Moving forward, the active, maintenance, and current versions of Node.js will be officially supported by Wrangler. This means the minimum officially supported version of Node.js you must have installed for Wrangler v4 will be Node.js v18 or later.
— Cloudflare, Use the latest JavaScript features with Wrangler CLI v4.0.0-rc.0
Check locally:
node --versionAdd to existing project lists Node.js 18+ as a prerequisite for Workers projects using a Wrangler configuration file.
esbuild upgrade in v4 and wildcard dynamic imports
Section titled “esbuild upgrade in v4 and wildcard dynamic imports”Wrangler v4 moves from esbuild v0.17.19 to v0.24, which can change bundle contents—especially wildcard dynamic imports:
Dynamic imports: Wildcard imports (for example,
import('./data/' + kind + '.json')) now automatically include all matching files in the bundle.— Cloudflare, Migrate from Wrangler v3 to v4
If bundles grow unexpectedly after upgrade, prefer explicit imports instead of path expressions that match globs.
Local-by-default CLI behavior in Wrangler v4
Section titled “Local-by-default CLI behavior in Wrangler v4”Commands that can run locally or against Cloudflare’s APIs now default to local mode; use --remote when you need live API calls. This affects how you interpret errors during dev, KV operations, and similar commands—local persistence is already default for wrangler dev (--persist was deprecated because persistence is automatic). See Deprecations for --persist.
Deprecated Wrangler commands and configuration: replacements before v4
Section titled “Deprecated Wrangler commands and configuration: replacements before v4”Deprecations is the authoritative list. Items deprecated in v3 were removed in v4.
| Deprecated | Use instead |
|---|---|
wrangler publish |
wrangler deploy |
wrangler pages publish |
wrangler pages deploy |
wrangler generate |
npm create cloudflare@latest for new projects |
wrangler version |
wrangler --version |
legacy_assets / --legacy-assets |
Workers Static Assets patterns |
node_compat / --node-compat |
nodejs_compat compatibility flag |
usage_model |
Remove (no effect after Standard Pricing) |
getBindingsProxy() from wrangler |
getPlatformProxy() with the same arguments |
type = "webpack" / webpack_config |
Custom builds and webpack migration |
The
wrangler publishcommand is deprecated, but still active in v3.wrangler publishwill be fully removed in v4. Usenpx wrangler deployto deploy Workers.— Cloudflare, Deprecations
Other platform shifts called out in deprecations:
- Workers Sites → migrate toward Workers Static Assets (Deprecations).
- Service environments via
legacy_env→ Wrangler Environments. - Pages projects moving to Workers-style dev/deploy: use
wrangler devandwrangler deployinstead ofwrangler pages dev/wrangler pages deploywhere applicable (Migrate from Pages to Workers); default dev ports differ (8788forpages devvs8787forwrangler dev, overridable with--port).
Custom builds ([build]): replace removed wrangler build
Section titled “Custom builds ([build]): replace removed wrangler build”The standalone wrangler build command from v1 is gone. For v2+, either rely on default esbuild bundling or declare a pre-step:
[build]command = "node ./scripts/bundle-worker.mjs"cwd = "build_cwd"watch_dir = "build_watch_dir"That command runs as part of wrangler dev and wrangler deploy (Configuration, Custom builds). To inspect bundle output without deploying, v2 deprecations note wrangler deploy --dry-run --outdir=path/to/build as the replacement pattern for old wrangler build (Deprecations).
Configuration fields Wrangler now infers (so you can delete them when modernizing): type, zone_id in many setups, and legacy build.upload.* shapes—see Common deprecations in Deprecations.
Wrangler shell tab completion: autocomplete deploy, dev, and subcommands
Section titled “Wrangler shell tab completion: autocomplete deploy, dev, and subcommands”Recent Wrangler releases ship tab completion for Bash, Zsh, Fish, and PowerShell:
Wrangler now includes built-in shell tab completion support, making it faster and easier to navigate commands without memorizing every option.
— Cloudflare, Shell tab completions for Wrangler CLI
Example for Zsh:
wrangler complete zsh >> ~/.zshrcsource ~/.zshrcCompletions stay aligned with the command registry; details are in General commands under wrangler complete. Some newer features state a minimum Wrangler version (for example 4.24.4+ in Deploy static sites to Workers without a configuration file and related changelog entries)—if a flag is missing, upgrade before assuming the docs are wrong.
Common migration mistakes with Wrangler configuration and assets
Section titled “Common migration mistakes with Wrangler configuration and assets”- Leaving
type = "webpack"after v2 — produces errors; migrate to[build]or external bundling (Migrate webpack projects, Deprecations). - Scripts still calling
wrangler publishorpages publish— fails on v4; switch todeploy/pages deploy(Deprecations). - Running Node.js 16 on CI — unsupported on v4; align runners with Node 18+ (Migrate from Wrangler v3 to v4).
- Outdated Wrangler with new Static Assets config — e.g. errors about
assets.bucketmay require Wrangler 3.78.10+ (Billing and Limitations). - Pages Wrangler config without 3.45.0+ — Pages projects need Wrangler 3.45.0 or higher to use a Wrangler configuration file (Configuration).
- Bare import specifiers that look like filenames — v2 logs deprecation warnings; use explicit relative paths like
./some-dependency.js(Deprecations).
For version-specific features (gradual deployments, wrangler versions), note minimum Wrangler versions such as 3.40.0 (and --x-versions before 3.73.0) in Gradual deployments and Workers commands.
How to check this on your site
Section titled “How to check this on your site”-
Run
node --versionand confirm a supported release for your target Wrangler major version (Node.js 18+ for v4 per Migrate from Wrangler v3 to v4). -
Run
npx wrangler --versionand compare with requirements in your docs (Pages config, Static Assets, or feature-specific changelog notes such as Deploy static sites to Workers without a configuration file). -
Search the repo for removed flags and config:
grep -rE "wrangler.*(--legacy-assets|--node-compat|publish|generate)" --include="package.json" .and grep Wrangler config forlegacy_assets,node_compat, andusage_modelas shown in Migrate from Wrangler v3 to v4. -
Run
npx wrangler devlocally, thennpx wrangler deploy(or your CI equivalent) and fix any configuration warnings using Deprecations; open targeted help withnpx wrangler docs [SEARCH]from General commands. -
You can check automatically in Answerwell (our tool): https://answerwell.org/workspace
Report an error or ask a question
Section titled “Report an error or ask a question”If something on this page does not match your experience or the linked Cloudflare docs, email yimasynthetic@gmail.com with the page URL and the exact wording you think is wrong so it can be corrected.