# Cloudflare Workers’ Node.js-Compatible Module Registry Rebuilt

Enhanced performance and standards compliance for serverless apps.

- **Source:** [Cloudflare Blog](https://blog.cloudflare.com)
- **Published:** 2026-09-09
- **Topic:** [Software & Engineering](https://brifing.si/c/engineering)
- **Original article:** <https://blog.cloudflare.com/workers-module-registry-nodejs/>
- **On Brifing:** https://brifing.si/s/df087d1e-32d8-413e-ba8b-e961fff4d2f1

## Introduction to the Module Registry

Cloudflare has rewritten the module registry in workerd, the core open-source component of the Workers runtime. This update aims to enhance speed, standards compliance, and alignment with Node.js's module registry. The Workers runtime now supports all stable Node.js APIs relevant for serverless contexts, enabling larger Node.js apps to be deployed on Cloudflare.

## Enhanced Node.js Compatibility

The Workers runtime now supports every stable API from Node.js that might be used in a serverless context. These APIs are enabled by default, allowing deployment of larger Node.js apps on Cloudflare, with the compressed bundle size limit removed, now supporting up to 64 MiB on all plans.

## Module Resolution Improvements

Node.js applications depend on how the runtime resolves, loads, and caches modules. The Workers runtime now handles ESM, CommonJS, and WebAssembly modules more effectively. The new_module_registry compatibility flag enables features like import.meta.url, import.meta.main, and import.meta.resolve(), improving module specifier parsing and resolution.

## Consistent Module Instance Resolution

The new module registry ensures that node: built-ins resolve to the same module instance regardless of the access path. Import attributes are correctly validated, and require() on an ES module follows Node.js's require(esm) rules, ensuring consistent error classes and messages.

## Lazy Compilation and WebAssembly Support

Modules now compile lazily upon their first import, whether static or dynamic. WebAssembly modules support source phase imports, enhancing performance and efficiency. These changes reduce initial load times and optimize resource usage in the Workers runtime.

## Impact on Bundling Tools

The new module registry allows bundlers like Rolldown to perform fewer transformations, relying more on the runtime for module resolution. This reduces the complexity of the bundling process and improves the efficiency of deploying Workers, especially when using tools like Vite.

## Handling Multiple Modules

The Workers runtime can now handle multiple modules more effectively, whether they are bundled into a single file or uploaded as separate modules. This flexibility allows developers to deploy Workers with the full module graph intact, as originally written.

## URL-Based Specifier Resolution

The new registry resolves specifiers as URLs rather than filesystem-style paths. This change enables cleaner implementation of features like import.meta.url and ensures relative imports follow the same resolution rules as new URL().

## Efficiency Improvements

The new registry compiles modules lazily and shares caches across V8 isolates, reducing redundant compilations and memory usage. This design improves performance and scalability, especially when running multiple replicas of the same Worker across CPU cores.

## Conclusion and Future Steps

The new module registry in Cloudflare Workers enhances Node.js compatibility, improves module resolution, and boosts performance. These changes pave the way for more efficient and scalable serverless applications, with ongoing improvements expected to further streamline the development and deployment process.

## Sources covering this story

- https://blog.cloudflare.com/workers-module-registry-nodejs/ — 

---

_Summary written by Brifing from the original reporting. Copyright in the original article belongs to its publisher; read the full piece at the link above._
