nayaread
HomeFavouritesTopicsSources
HomeFavouritesTopicsSources
NayaRead links to original engineering blogs. All copyright belongs to the respective authors.
The Cloudflare Blog·Sep 9, 2026·9 min read·Logan Gatlin65

How we rebuilt Cloudflare Workers’ module registry for Node.js compatibility

Workers now enables Node.js compatibility by default, supports applications up to 64 mebibytes, and adds a URL-based module registry with import.meta, lazy compilation, shared code caches, and clearer errors.

JavaScript
AI summarygenerated from the source article

Cloudflare Workers can now deploy Node.js applications up to 64 MiB with zero limits on compressed bundle size, all while dropping the requirement to collapse your code into a single monolithic file. 👇

Historically, Workers tooling bundled an entire application into one massive JavaScript file. The underlying runtime, `workerd`, treated imports as filesystem paths rather than standard URLs. This broke web and Node.js primitives like `import.meta.url`, `import.meta.resolve()`, and specifier query parameters. It also forced `workerd` to compile every module up front and duplicate that compiled code across every V8 isolate replica.

Cloudflare completely rebuilt the `workerd` module registry around standard URL resolution, lazy compilation, and shared module caching.

The new registry treats every specifier as a URL under the hood. Importing `./counter.js?a` and `./counter.js?b` now creates two distinct module instances with separate top-level state, matching browser spec compliance.

Import attributes are strictly validated. Passing an unknown attribute key or a mismatched type now throws an exception rather than silently disappearing.

When calling `require()` on an ES module, the runtime follows Node.js' exact `require(esm)` rules. It returns the module's `module.exports` string export or its namespace object. If the target module contains a top-level `await`, `require()` immediately throws an error because synchronous imports cannot wait for asynchronous evaluation.

Modules now compile lazily upon their first import rather than during initial runtime startup. Cloudflare also added support for WebAssembly source phase imports, allowing developers to import raw `WebAssembly.Module` objects directly using `import source`.

The rewrite gives Workers full Node.js module resolution parity, predictable error classes across all import paths, and allows bundlers like Rolldown to emit clean, multi-module graphs. You can test the new engine today by enabling the `new_module_registry` compatibility flag.

Read original on blog.cloudflare.com

Discussion around the web

  • Hacker News6 · 0 💬

Score breakdown

  • Technical depth84
  • Practical value75
  • Originality60
  • Writing quality100
  • Source reputation0
  • Recency96
  • External engagement10
  • On-site engagement0

NayaRead shows a summary and links to the original article. The full article is hosted on blog.cloudflare.com.

More like this

The Cloudflare Blog

Introducing workerd: the Open Source Workers runtime

Sep 27, 2022·19 min read
The Cloudflare Blog

Unpacking Cloudflare Workers CPU Performance Benchmarks

Oct 14, 2025·28 min read
The Cloudflare Blog

Everyone can now run JavaScript on Cloudflare with Workers

Mar 13, 2018·13 min read
The Cloudflare Blog

WebAssembly on Cloudflare Workers

Oct 1, 2018·11 min read