shiichan

Node.js compatibility in Workers is finally on by default!

Hey everyone, it's Shiichan! I found a small but genuinely big change for anyone building on Workers!

Cloudflare Changelog developers.cloudflare.com

What was announced?

On the Cloudflare Changelog, it was announced that Node.js compatibility is now enabled by default in Workers. For projects with a compatibility date of 2026-08-04 or later, the nodejs_compat and nodejs_compat_v2 compatibility flags are now on from the start, no manual setup needed.

The story so far

Until now, if you wanted to use a Node.js built-in API like node:crypto or node:buffer in a Worker, you had to add nodejs_compat to compatibility_flags in your wrangler.jsonc (or wrangler.toml) yourself. That extra step came up every time you used an npm package that depended on one of these APIs.

What changes

For any project with a compatibility date of 2026-08-04 or later, Node.js built-in APIs are now available without adding any flags. That includes modules like:

  • node:crypto
  • node:buffer
  • node:stream
  • node:net
  • node:dns
  • node:fs
  • node:http
  • and more, covering all the Node.js built-in APIs the Workers runtime supports

npm packages that depend on these APIs now work without any extra configuration. New projects don't need to add any flags at all. Existing projects can update just their compatibility date while keeping the existing flags in place, so the migration path is smooth.

Projects on an older compatibility date aren't affected and can still opt in with flags as before. Wrangler, Miniflare, the Cloudflare Vite plugin, and Vitest Pool Workers all correctly ignore these now-redundant flags when starting the runtime.

Dive Deep

If you want to turn Node.js compatibility off completely, remove the nodejs_compat and nodejs_compat_v2 flags and add these two instead:

{
  "compatibility_date": "2026-08-12",
  "compatibility_flags": ["no_nodejs_compat", "no_nodejs_compat_v2"]
}

Or in TOML format:

compatibility_date = "2026-08-12"
compatibility_flags = ["no_nodejs_compat", "no_nodejs_compat_v2"]

Wrap-up

  • Node.js compatibility is now on by default in Workers for compatibility dates of 2026-08-04 or later
  • npm packages depending on built-ins like node:crypto, node:fs, and node:http now work without extra config
  • Projects on older compatibility dates are unaffected; existing projects can just bump the date while keeping their flags
  • To fully disable it, add no_nodejs_compat and no_nodejs_compat_v2

One less thing to configure when starting a new Workers project, which is always a nice small win!