Repository navigation
fix(@angular/build): use module.registerHooks() for in-memory ESM loader - #34359
Merged
Merged
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the ESM in-memory loader hooks to run synchronously by replacing readFile with readFileSync and updating the load function and its associated tests. It also attempts to change the hook registration mechanism in register-hooks.ts to use registerHooks. However, a critical issue was identified: registerHooks is not a valid Node.js API, and because ESM loaders run in a separate thread, local function references cannot be passed directly. The registration must be reverted to use the standard register() API with the loader file path.
Node.js 26 runtime-deprecates `module.register()` (`DEP0205`) in favor of
synchronous `module.registerHooks()`.
Update the server-rendering in-memory ESM loader hooks to make `load`
synchronous using `readFileSync` and register the hooks directly via
`registerHooks({ resolve, load })`.
Closes angular#34358
alan-agius4
force-pushed
the
fix-register-hooks-dep0205
branch
from
October 15, 2026 12:30
7b28748 to
943f21e
Compare
clydin
approved these changes
Oct 15, 2026
Collaborator
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Node.js 26 runtime-deprecates
module.register()(DEP0205) in favor of synchronousmodule.registerHooks().Update the server-rendering in-memory ESM loader hooks to make
loadsynchronous usingreadFileSyncand register the hooks directly viaregisterHooks({ resolve, load }).Closes #34358