Skip to content

Commit dee6e8f

Browse files
authored
Change notes and mentions of node compat v2 (cloudflare#19079)
* Change notes and mentions of node compat v2 * Fixing the failed check * Update src/content/docs/browser-rendering/platform/wrangler.mdx * Update src/content/docs/browser-rendering/platform/wrangler.mdx * Update src/content/docs/browser-rendering/platform/wrangler.mdx * to fix failed check * Update src/content/docs/browser-rendering/platform/wrangler.mdx
1 parent 8799d80 commit dee6e8f

File tree

5 files changed

+8
-13
lines changed

5 files changed

+8
-13
lines changed

src/content/docs/browser-rendering/platform/wrangler.mdx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ sidebar:
55
order: 20
66
---
77

8+
import { Render, WranglerConfig } from "~/components"
9+
810
[Wrangler](/workers/wrangler/) is a command-line tool for building with Cloudflare developer products.
911

1012
Use Wrangler to deploy projects that use the Workers Browser Rendering API.
@@ -19,12 +21,7 @@ To install Wrangler, refer to [Install and Update Wrangler](/workers/wrangler/in
1921

2022
To deploy a Browser Rendering Worker, you must declare a [browser binding](/workers/runtime-apis/bindings/) in your Worker's `wrangler.toml` configuration file.
2123

22-
:::note[Wrangler configuration]
23-
24-
If you are using [Puppeteer](/browser-rendering/platform/puppeteer/) in your Worker code, then you also need to add "nodejs_compat_v2" to the compatibility_flags in your Worker's `wrangler.toml` configuration. More information [here](/workers/runtime-apis/nodejs/#enable-nodejs-with-workers), including for [pages functions](/workers/runtime-apis/nodejs/#enable-nodejs-with-pages-functions).
25-
:::
26-
27-
import { WranglerConfig } from "~/components";
24+
<Render file="nodejs-compat-howto" product="workers" />
2825

2926
<WranglerConfig>
3027

src/content/docs/workers/tutorials/generate-dynamic-og-images-using-workers/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ minify = true
214214
watch_dir = "public"
215215
```
216216

217-
The `nodejs_compat_v2` flag enables runtime compatibility features required by the OG image generation library, even when using Bun. While we're using Bun as our development runtime, this flag ensures all necessary APIs are available in the Workers environment. The `assets` configuration maps your Worker's public directory, allowing direct access to static files like fonts, images, and favicons through URL paths (for example, `/fonts/Inter.ttf`, `/images/logo.png`).
217+
[The `nodejs_compat` flag](/workers/configuration/compatibility-flags/#nodejs-compatibility-flag) enables runtime compatibility features required by the OG image generation library, even when using Bun. While we're using Bun as our development runtime, this flag ensures all necessary APIs are available in the Workers environment. The `assets` configuration maps your Worker's public directory, allowing direct access to static files like fonts, images, and favicons through URL paths (for example, `/fonts/Inter.ttf`, `/images/logo.png`).
218218

219219
## 4. Configure font loading strategies
220220

src/content/docs/workers/tutorials/postgres/index.mdx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ cd postgres-tutorial
5858

5959
### Enable Node.js compatibility
6060

61-
When creating your Worker application, [enable Node.js APIs](/workers/runtime-apis/nodejs/#enable-nodejs-with-workers) by including the
62-
"nodejs_compat_v2" compatibility flag to your `wrangler.toml`. This will be needed to use the library to connect to your PostgreSQL database.
61+
<Render file="nodejs-compat-howto" />
6362

6463
import { WranglerConfig } from "~/components";
6564

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ At a minimum, the `name`, `main` and `compatibility_date` keys are required to d
171171

172172
- `node_compat` <Type text="boolean" /> <MetaInfo text="optional" />
173173

174-
- Deprecated — Instead, [enable the `nodejs_compat_v2` compatibility flag](/workers/runtime-apis/nodejs/#enable-nodejs-with-workers), which enables both built-in Node.js APIs, and adds polyfills as necessary.
174+
- Deprecated — Instead, [enable the `nodejs_compat` compatibility flag](/workers/configuration/compatibility-flags/#nodejs-compatibility-flag), which enables both built-in Node.js APIs, and adds polyfills as necessary.
175175
Setting `node_compat = true` will add polyfills for Node.js built-in modules and globals to your Worker's code, when bundled with Wrangler.
176176
This is powered by `@esbuild-plugins/node-globals-polyfill` which in itself is powered by [rollup-plugin-node-polyfills](https://github.com/ionic-team/rollup-plugin-node-polyfills/).
177177

src/content/partials/workers/nodejs-compat-howto.mdx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33

44
---
55

6-
:::caution
6+
:::note
77

8-
9-
To use Node.js APIs in your Worker, add the [`nodejs_compat_v2` compatibility flag](/workers/configuration/compatibility-flags/#nodejs-compatibility-flag) to your `wrangler.toml` file.
8+
To enable built-in Node.js APIs and polyfills, add the nodejs_compat compatibility flag to your `wrangler.toml`. This also enables nodejs_compat_v2 as long as your compatibility date is 2024-09-23 or later. [Learn more about the Node.js compatibility flag and v2](/workers/configuration/compatibility-flags/#nodejs-compatibility-flag).
109

1110

1211
:::

0 commit comments

Comments
 (0)