Cloudflare has rewritten the module registry within workerd, the core open-source component of the Workers runtime, to be faster, more standards-compliant, and more closely aligned with Node.js’ module registry. The change comes with broader Node.js API support enabled by default and a removal of the former bundle-size cap for compressed bundles.
- Faster module handling
- Better alignment with Node.js module resolution
- Default enablement of Node.js APIs in Workers
WHAT CHANGED IN THE MODULE REGISTRY
The Workers runtime now supports every stable Node.js API developers might want to use in a serverless context, and these APIs are enabled by default. Cloudflare has removed the compressed bundle size limit, allowing larger deployments across all plans. TechStaged has also covered Cloudflare revisits remote Spectre attacks on Workers, reports mitigated risk after production assessment.
The new registry handles how Node.js applications resolve, load, and cache modules, across ESM, CommonJS, and WebAssembly, within the Workers environment.
- Default Node.js API compatibility
- Removal of compressed bundle size limit (64 MiB on all plans)
- Unified handling for ESM, CommonJS, and WebAssembly
NODE.JS COMPATIBILITY BY DEFAULT
The module registry redesign is part of broader efforts to support Node.js runtime APIs inside Workers. By enabling the new_module_registry compatibility flag, developers can access features such as import.meta.url, import.meta.main, and import.meta.resolve() in their Worker code.
- import.meta.url/main/resolve support
- Node.js API parity in Workers
- Flag-driven opt-in for module registry features
HOW MODULE RESOLUTION AND SPECIFIERS WORK NOW
Module specifiers are parsed and resolved as real URLs. Node.js built-ins resolve to the same module instance regardless of access path. Import attributes (such as type: 'json') are validated, and the registry applies consistent error classes and messages for loading failures.
- URLs as specifiers
- Consistent error handling
- Import attributes validation (json)
BUNDLING, BUNDLERS, AND THE RUNTIME GRAPH
The system compiles modules lazily when first imported. WebAssembly modules support source-phase imports. Bundlers like Rolldown can reduce the module graph that reaches the Workers runtime, improving deploy efficiency. Wrangler often bundles code into a single module using esbuild, while Vite users may see Rolldown-based builds.
- Lazy compilation
- Source-phase WebAssembly imports
- Impact on bundlers and module graphs
GETTING STARTED FOR DEVELOPERS
Enabling the new module registry requires setting the new_module_registry compatibility flag in your Worker. Deployed Workers continue to function as before, and there is no automatic activation date for this setting. If you deploy with --no-bundle or upload multiple modules, the full module graph is visible to the runtime.
- Enable via new_module_registry flag
- Existing Workers remain functional
- Full module graph when not bundled
WHAT THIS MEANS FOR THE CLOUDFLARE ECOSYSTEM
The overhaul signals a closer alignment with Node.js expectations for module loading and caching, which could simplify migrating Node.js apps to Cloudflare Workers. The docs in workerd provide a deeper dive into the changes and their interaction with V8’s module APIs.
- Node.js migration pathways
- Deeper workspace documentation
RELATED COVERAGE
- Cloudflare revisits remote Spectre attacks on Workers, reports mitigated risk after production assessment
- Cloudflare migrates its blog to EmDash CMS, reporting performance gains and a zero-downtime rollout
- Google unveils Finland energy blueprint tying nuclear life extension to grid resilience and affordable power
- Google commits €13 billion to Finland for AI infrastructure and green-energy expansion
- Software articles
SOURCES
- Cloudflare Blog: How we rebuilt Cloudflare Workers’ module registry for Node.js compatibility Published · Primary source







