Repository navigation
fix(@angular/build): use module.registerHooks() for in-memory ESM loader - #34359
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
7b28748 to
943f21e
Compare
|
This pull request has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
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