-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrangler v4 migration guide #18726
Draft
korinne
wants to merge
5
commits into
production
Choose a base branch
from
wrangler-v4-migration
base: production
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Wrangler v4 migration guide #18726
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
63b6e93
adds migration guide draft for Wrangler v4
korinne d6e90e2
Fixes typos and reorders migration docs to start with v4
korinne e8c3c71
Update src/content/docs/workers/wrangler/migration/update-v3-to-v4.mdx
korinne b9fd1df
Update src/content/docs/workers/wrangler/migration/update-v3-to-v4.mdx
korinne ffb95b1
Update src/content/docs/workers/wrangler/migration/update-v3-to-v4.mdx
korinne File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
title: Migrate from Wrangler v2 to v3 | ||
pcx_content_type: how-to | ||
sidebar: | ||
order: 1 | ||
order: 2 | ||
|
||
--- | ||
|
||
|
61 changes: 61 additions & 0 deletions
61
src/content/docs/workers/wrangler/migration/update-v3-to-v4.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
--- | ||
title: Migrate from Wrangler v3 to v4 | ||
pcx_content_type: how-to | ||
sidebar: | ||
order: 1 | ||
|
||
--- | ||
Wrangler v4 is a major release focused on updates to underlying systems and dependencies, along with improvements to keep Wrangler commands consistent and clear. While many users should expect a no-op upgrade, the following sections outline significant changes and steps for migrating where necessary. | ||
|
||
### Summary of changes | ||
* **Updated Node.js Support Policy:** | ||
Node.js v16, which reached End-of-Life in 2022, is no longer supported in Wrangler v4. Wrangler now follows Node.js's [official support lifecycle](https://nodejs.org/en/about/previous-releases). | ||
|
||
* **esbuild Version Upgrade**: Wrangler v4 uses [esbuild](https://esbuild.github.io/) to bundle Worker code before deploying it, and was previously pinned to esbuild v0.17.19. Wrangler v4 uses esbuild v0.24, which could impact dynamic wildcard imports. | ||
|
||
* **Commands default to local mode**: All commands now run in local mode by default, requiring a `--remote` flag for API queries, | ||
|
||
* **Changes to KV command output formats**: `wrangler kv list` now outputs data in a format compatible with `wrangler kv bulk delete.` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can remove this |
||
|
||
* **Deprecated commands and configurations removed:** Legacy commands, flags, and configurations have been removed. | ||
|
||
## Detailed Changes | ||
|
||
### Updated Node.js Support Policy | ||
|
||
Wrangler now supports only Node.js versions that align with [Node.js's official lifecycle](https://nodejs.org/en/about/previous-releases): | ||
* **Supported**: Current, Active LTS, Maintenance LTS | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it worth calling out that this currently means 18, 20, 22, but we'll be dropping 18 relatively soon? |
||
* **No longer supported:** Node.js v16 (EOL in 2022) | ||
|
||
Wrangler tests no longer run on v16, and users still on this version may encounter unsupported behavior. Users still using Node.js v16 must upgrade to a supported version (v18 or higher) to continue receiving support and compatibility with Wrangler. | ||
korinne marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
### esbuild Version Upgrade | ||
|
||
Wrangler upgraded esbuild from **v0.17.19** to **v0.24**, bringing improvements (such as the ability to use the `using` keyword with RPC) and changes to bundling behavior: | ||
korinne marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* **Dynamic imports:** Wildcard imports (e.g., `import('./data/' + kind + '.json')`) now automatically include all matching files in the bundle. | ||
korinne marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
||
Users relying on wildcard dynamic imports may see unwanted files bundled. Prior to esbuild v0.19, `import` statements with dynamic paths ( like `import('./data/' + kind + '.json')`) did not bundle all files matches the glob pattern (`*.json`) . Only files explicitly referenced or included using `find_additional_modules` were bundled. With esbuild v0.19, wildcard imports now automatically bundle all files matching the glob pattern. This could result in unwanted files being bundled, so users might want to avoid wildcard dynamic imports and use explicit imports instead. | ||
|
||
### Commands default to local mode | ||
|
||
|
||
All commands now run in **local mode by default.** Wrangler has many commands for accessing resources like KV and R2, but the commands were previously inconsistent in whether they run in a local or remote environment. For example, D1 defaults to querying a local datastore, and requires the `--remote` flag to query via the API. KV, on the other hand, previously defaulted to querying via the API (implicitly using the `--remote` flag) and required a `--local` flag to query a local datastore. In order to make the behavior consistent across Wrangler, each command now uses the `--local` flag by default, and will require an explicit `--remote` flag to query via the API. | ||
|
||
For example: | ||
|
||
* **Previous Behavior (Wrangler v3):** `wrangler kv list` queried remotely by default. | ||
* **New Behavior (Wrangler v4):** `wrangler kv list` queries locally unless `--remote` is specified. | ||
|
||
|
||
Those using `wrangler kv` and/or `wrangler r2` commands to query or write to their data store will need to add the `--remote` flag in order to replicate previous behavior. | ||
|
||
### Changes to KV command output formats | ||
|
||
The output format of `wrangler kv list` has been updateed to align with the input format for `wrangler kv bulk delete.` | ||
|
||
Scripts or tools relying on the old `wrangler kv list` output format will need to be updated to handle the new format. | ||
|
||
### Deprecated Commands and Configurations Removed | ||
|
||
TBD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be slightly reworded to make it clear it refers to the versions of Node you can run Wrangler in rather than the version of Node that Wrangler supports (which to me potentially implies that it'd work in a Worker)?