Repository navigation
modules: add guide for migrating from module.register() - #190
GeoffreyBooth wants to merge 2 commits into
Conversation
Node.js 27 removes `module.register()` and the `--experimental-loader` and `--loader` flags (DEP0205). Explain how to move to `module.registerHooks()`, what behaves differently, and what to use when hooks need asynchronous work (`module-register-ponyfill` or `everysync`). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
👋 Codeowner Review RequestThe following codeowners have been identified for the changed files: Team reviewers: @nodejs/loaders @nodejs/nodejs-website Please review the changes when you have a chance. Thank you! 🙏 |
|
Should this be a learn article or a blog cc @nodejs/nodejs-website |
There was a problem hiding this comment.
🟡 Changes recommended
The migration guide overstates registration-chain compatibility and omits an explicit network-appropriate timeout, so valid hook bootstrapping or module downloads can fail.
2 open issues
What changed in this PR
Adds a migration guide to the Node.js learning documentation for the removal of module.register() and loader flags in Node.js 27.
Changes:
- Explains migration to
registerHooks()with before-and-after examples and behavioral differences. - Covers asynchronous alternatives, worker setup, and troubleshooting.
- Links the guide from the Modules navigation.
| File | Description |
|---|---|
site.json |
Adds the migration guide to the Modules navigation. |
pages/modules/migrating-from-module-register.md |
Documents migration paths, examples, compatibility considerations, and common errors. |
Review effort: Balanced
Document the ponyfill's cross-hook loading divergence, set an explicit `everysync` timeout in the example and explain the default, and show the `ERR_MODULE_REGISTER_REMOVED` error that `module.register()` now throws. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Perhaps both? This page is meant to be the durable how-to, which is why I put it in Learn: it shows how to migrate, with working examples, and it will stay useful as people upgrade over time. A blog post can announce when nodejs/node#67090 lands and point people to this article. |


Node.js 27 removes
module.register()and the--experimental-loader/--loaderflags (DEP0205); the removal is in nodejs/node#67090. A reviewer there asked for a landing page explaining the migration before 27.0.0 ships, and this is it.The page covers:
module.registerHooks(), usingmodule-register-ponyfill, or building a bridge witheverysyncresolve/loadhooks module, and replacing--loaderwith--importinitialize/data), can't be async, now apply torequire(), and aren't inherited by workerseverysyncexampleIt is linked from the "Modules" group in
site.json. I ran every code example against a Node.js build withregister()removed.🤖 Generated with Claude Code