Skip to content

Commit cecf0b1

Browse files
committed
Change notes and mentions of node compat v2
1 parent e1083ff commit cecf0b1

File tree

5 files changed

+6
-11
lines changed

5 files changed

+6
-11
lines changed

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@ To install Wrangler, refer to [Install and Update Wrangler](/workers/wrangler/in
1919

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

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-
:::
22+
<Render file="nodejs-compat-howto" />
2623

2724
import { WranglerConfig } from "~/components";
2825

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
@@ -166,7 +166,7 @@ At a minimum, the `name`, `main` and `compatibility_date` keys are required to d
166166

167167
- `node_compat` <Type text="boolean" /> <MetaInfo text="optional" />
168168

169-
- 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.
169+
- 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.
170170
Setting `node_compat = true` will add polyfills for Node.js built-in modules and globals to your Worker's code, when bundled with Wrangler.
171171
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/).
172172

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)