Skip to content

Commit c7b4a10

Browse files
penalosalrapoport-cfhyperlint-ai[bot]irvinebroque
authored
Add Wrangler v4 RC changelog entry (#20355)
* Add v4 RC changelog entry * Apply suggestions from code review Co-authored-by: lrapoport-cf <[email protected]> Co-authored-by: hyperlint-ai[bot] <154288675+hyperlint-ai[bot]@users.noreply.github.com> * Copy and language updates * More updates * Update 2025-02-27-wrangler-v4-rc.mdx * Apply suggestions from code review * Add more detail to deprecations * Update src/content/changelog/workers/2025-02-27-wrangler-v4-rc.mdx Co-authored-by: lrapoport-cf <[email protected]> * Update src/content/changelog/workers/2025-02-27-wrangler-v4-rc.mdx Co-authored-by: lrapoport-cf <[email protected]> * Add current deprecations to v3 deprecations page * fix headers * undo format * use today date --------- Co-authored-by: lrapoport-cf <[email protected]> Co-authored-by: hyperlint-ai[bot] <154288675+hyperlint-ai[bot]@users.noreply.github.com> Co-authored-by: Brendan Irvine-Broque <[email protected]>
1 parent 15a2ec6 commit c7b4a10

File tree

2 files changed

+80
-0
lines changed

2 files changed

+80
-0
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
---
2+
title: Use the latest JavaScript features with Wrangler CLI v4.0.0-rc.0
3+
description: You can now try out the v4 RC for Wrangler by installing `[email protected]`
4+
products:
5+
- workers
6+
date: 2025-02-28T22:30:00Z
7+
---
8+
9+
import { PackageManagers } from "~/components";
10+
11+
We've released a release candidate of the next major version of [Wrangler](/workers/wrangler/), the CLI for Cloudflare Workers — `[email protected]`.
12+
13+
You can run the following command to install it and be one of the first to try it out:
14+
15+
<PackageManagers pkg="wrangler@v4-rc" />
16+
17+
Unlike previous major versions of Wrangler, which were [foundational rewrites](https://blog.cloudflare.com/wrangler-v2-beta/) and [rearchitectures](https://blog.cloudflare.com/wrangler3/) — Version 4 of Wrangler includes a much smaller set of changes. If you use Wrangler today, your workflow is very unlikely to change. Before we release Wrangler v4 and advance past the release candidate stage, we'll share a detailed migration guide in the Workers developer docs. But for the vast majority of cases, you won't need to do anything to migrate — things will just work as they do today. We are sharing this release candidate in advance of the official release of v4, so that you can try it out early and share feedback.
18+
19+
#### New JavaScript language features that you can now use with Wrangler v4
20+
21+
Version 4 of Wrangler updates the version of [esbuild](https://esbuild.github.io/) that Wrangler uses internally, allowing you to use modern JavaScript language features, including:
22+
23+
##### The `using` keyword from Explicit Resource Management
24+
25+
The [`using` keyword from the Explicit Resource Management standard](/workers/runtime-apis/rpc/lifecycle/#explicit-resource-management) makes it easier to work with the [JavaScript-native RPC system built into Workers](/workers/runtime-apis/rpc/). This means that when you obtain a stub, you can ensure that it is automatically disposed when you exit scope it was created in:
26+
27+
```js
28+
function sendEmail(id, message) {
29+
using user = await env.USER_SERVICE.findUser(id);
30+
await user.sendEmail(message);
31+
32+
// user[Symbol.dispose]() is implicitly called at the end of the scope.
33+
}
34+
```
35+
36+
##### Import attributes
37+
38+
[Import attributes](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import/with) allow you to denote the type or other attributes of the module that your code imports. For example, you can import a JSON module, using the following syntax:
39+
40+
```js
41+
import data from "./data.json" with { type: "json" };
42+
```
43+
44+
#### Other changes
45+
46+
##### `--local` is now the default for all CLI commands
47+
48+
All commands that access resources (for example, `wrangler kv`, `wrangler r2`, `wrangler d1`) now access local datastores by default, ensuring consistent behavior.
49+
50+
##### Clearer policy for the minimum required version of Node.js required to run Wrangler
51+
52+
Moving forward, the [active, maintenance, and current versions of Node.js](https://nodejs.org/en/about/previous-releases) 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. This policy mirrors how many other packages and CLIs support older versions of Node.js, and ensures that as long as you are using a version of Node.js that the Node.js project itself supports, this will be supported by Wrangler as well.
53+
54+
##### Features previously deprecated in Wrangler v3 are now removed in Wrangler v4
55+
56+
All previously deprecated features in [Wrangler v2](https://developers.cloudflare.com/workers/wrangler/deprecations/#wrangler-v2) and in [Wrangler v3](https://developers.cloudflare.com/workers/wrangler/deprecations/#wrangler-v3) have now been removed. Additionally, the following features that were deprecated during the Wrangler v3 release have been removed:
57+
58+
- Legacy Assets (using `wrangler dev/deploy --legacy-assets` or the `legacy_assets` config file property). Instead, we recommend you [migrate to Workers assets](https://developers.cloudflare.com/workers/static-assets/).
59+
- Legacy Node.js compatibility (using `wrangler dev/deploy --node-compat` or the `node_compat` config file property). Instead, use the [`nodejs_compat` compatibility flag](https://developers.cloudflare.com/workers/runtime-apis/nodejs). This includes the functionality from legacy `node_compat` polyfills and natively implemented Node.js APIs.
60+
- `wrangler version`. Instead, use `wrangler --version` to check the current version of Wrangler.
61+
- `getBindingsProxy()` (via `import { getBindingsProxy } from "wrangler"`). Instead, use the [`getPlatformProxy()` API](https://developers.cloudflare.com/workers/wrangler/api/#getplatformproxy), which takes exactly the same arguments.
62+
- `usage_model`. This no longer has any effect, after the [rollout of Workers Standard Pricing](https://blog.cloudflare.com/workers-pricing-scale-to-zero/).
63+
64+
We'd love your feedback! If you find a bug or hit a roadblock when upgrading to Wrangler v4, [open an issue on the `cloudflare/workers-sdk` repository on GitHub](https://github.com/cloudflare/workers-sdk/issues/new?template=bug-template.yaml).

src/content/docs/workers/wrangler/deprecations.mdx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ The `wrangler pages publish` command is deprecated, but still active in v3. `wra
3333

3434
Use [`wrangler pages deploy`](/workers/wrangler/commands/#deploy-1) to deploy Pages.
3535

36+
#### `version`
37+
38+
Instead, use `wrangler --version` to check the current version of Wrangler.
39+
3640
### Deprecated options
3741

3842
#### `--experimental-local`
@@ -51,6 +55,18 @@ Use [`wrangler pages deploy`](/workers/wrangler/commands/#deploy-1) to deploy Pa
5155

5256
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>`.
5357

58+
#### `--legacy-assets` and the `legacy_assets` config file property
59+
60+
We recommend you [migrate to Workers assets](https://developers.cloudflare.com/workers/static-assets/)
61+
62+
#### `--node-compat` and the `node_compat` config file property
63+
64+
Instead, use the [`nodejs_compat` compatibility flag](https://developers.cloudflare.com/workers/runtime-apis/nodejs). This includes the functionality from legacy `node_compat` polyfills and natively implemented Node.js APIs.
65+
66+
#### The `usage_model` config file property
67+
68+
This no longer has any effect, after the [rollout of Workers Standard Pricing](https://blog.cloudflare.com/workers-pricing-scale-to-zero/).
69+
5470
## Wrangler v2
5571

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

0 commit comments

Comments
 (0)