EDGE Signal 197
How we rebuilt Cloudflare Workers’ module registry for Node.js compatibility
Cloudflare Workers' rebuilt module registry resolves specifiers as URLs, supports import.meta, and is enabled via a compatibility flag, with Node.js APIs on by default and a 64 MiB bundle limit.
For engineers deploying Node.js applications to Workers, the new registry means module resolution now matches Node.js and web standards, so bundlers can do less transformation and existing apps can run with fewer changes. Enabling the flag is required to get these features, and the raised bundle limit allows larger applications. The change is specific to the workerd runtime, so it only affects Cloudflare Workers deployments.
Written by elseif from the cluster below · every claim links back to a sourceThe three things worth knowing
The new module registry parses and resolves module specifiers as real URLs, including query strings and fragments, and supports import.meta.url, import.meta.main, and import.meta.resolve().
Node.js built-ins resolve to the same module instance regardless of how they are reached, and require() on ES modules follows Node.js' require(esm) rules.
Modules compile lazily on first import, WebAssembly source phase imports are supported, and errors use consistent classes and messages across loading paths.
THE CLUSTER
↗