INTEGRITY Cloudflare Docs

Deprecations

Review the difference between Wrangler versions, specifically deprecations and breaking changes.

Wrangler v4

Workers Sites

Usage of Workers Sites is deprecated. Instead, we recommend migrating to Workers Static Assets. Support for using Workers Sites with Wrangler will be removed in a future version of Wrangler.

Service environments

Usage of Service Environments, enabled via the legacy_env property in Wrangler config, is deprecated. Instead, we recommend migrating to Wrangler Environments. Support for using Service Environments with Wrangler will be removed in a future version of Wrangler.

Wrangler v3

Deprecated commands

The following commands are deprecated in Wrangler as of Wrangler v3. These commands will be fully removed in a future version of Wrangler.

generate

The wrangler generate command is deprecated, but still active in v3. wrangler generate will be fully removed in v4.

Use npm create cloudflare@latest for new Workers and Pages projects.

publish

The wrangler publish command is deprecated, but still active in v3. wrangler publish will be fully removed in v4.

Use npx wrangler deploy to deploy Workers.

pages publish

The wrangler pages publish command is deprecated, but still active in v3. wrangler pages publish will be fully removed in v4.

Use wrangler pages deploy to deploy Pages.

version

Instead, use wrangler --version to check the current version of Wrangler.

Deprecated options

--experimental-local

wrangler dev in v3 is local by default so this option is no longer necessary.

--local

wrangler dev in v3 is local by default so this option is no longer necessary.

--persist

wrangler dev automatically persists data by default so this option is no longer necessary.

-- <command>, --proxy, and --script-path in wrangler pages dev

These options prevent wrangler pages dev from being able to accurately emulate production's behavior for serving static assets and have therefore been deprecated. Instead of relying on Wrangler to proxy through to some other upstream dev server, you can emulate a more accurate behavior by building your static assets to a directory and pointing Wrangler to that directory with wrangler pages dev <directory>.

--legacy-assets and the legacy_assets config file property

We recommend you migrate to Workers assets

--node-compat and the node_compat config file property

Instead, use the nodejs_compat compatibility flag. This includes the functionality from legacy node_compat polyfills and natively implemented Node.js APIs.

The usage_model config file property

This no longer has any effect, after the rollout of Workers Standard Pricing.

Wrangler v2

Wrangler v2 introduces new fields for configuration and new features for developing and deploying a Worker, while deprecating some redundant fields.

The following video describes some of the major changes in Wrangler v2, and shows you how Wrangler v2 can help speed up your workflow.

Common deprecations

Refer to the following list for common fields that are no longer required.

New fields

These are new fields that can be added to your Wrangler configuration file.

Non-mandatory fields

A few configuration fields which were previously required, are now optional in particular situations. They can either be inferred, or added as an optimization. No fields are required anymore when starting with Wrangler v2, and you can gradually add configuration as the need arises.

Deprecated fields (non-breaking)

A few configuration fields are deprecated, but their presence is not a breaking change yet. It is recommended to read the warning messages and follow the instructions to migrate to the new configuration. They will be removed and stop working in a future version.

Deprecated fields (breaking)

A few configuration fields are deprecated and will not work as expected anymore. It is recommended to read the error messages and follow the instructions to migrate to the new configuration.

Deprecated commands

The following commands are deprecated in Wrangler as of Wrangler v2.

build

The wrangler build command is no longer available for building the Worker.

The equivalent functionality can be achieved by wrangler publish --dry-run --outdir=path/to/build.

config

The wrangler config command is no longer available for authenticating via an API token.

Use wrangler login / wrangler logout to manage OAuth authentication, or provide an API token via the CLOUDFLARE_API_TOKEN environment variable.

preview

The wrangler preview command is no longer available for creating a temporary preview instance of the Worker.

Try using wrangler dev to try out a worker during development.

subdomain

The wrangler subdomain command is no longer available for creating a workers.dev subdomain.

Create the workers.dev subdomain in Workers & Pages > select your Worker > Your subdomain > Change.

route

The wrangler route command is no longer available to configure a route for a Worker.

Routes are specified in the Wrangler configuration file.

Other deprecated behavior

Wrangler v1 and v2 comparison tables

Commands

Command v1 v2 Notes
publish
dev
preview Removed, use dev instead.
init
generate Removed, use git clone instead.
build Removed, invoke your own build script instead.
secret
route Removed, use publish instead.
tail
kv
r2 🚧 Introduced in Wrangler v1.19.8.
pages
config
login
logout
whoami
subdomain
report Removed, error reports are made interactively.

Configuration

Property v1 v2 Notes
type = "webpack" Removed, refer to this guide to migrate.
type = "rust" Removed, use workers-rs instead.
type = "javascript" 🚧 No longer required, can be omitted.

Features

Feature v1 v2 Notes
TypeScript You can give wrangler a TypeScript file, and it will automatically transpile it to JavaScript using esbuild under-the-hood.
Local mode wrangler dev --local will run your Worker on your local machine instead of on our network. This is powered by Miniflare.