Skip to content

fix(ext/node): make registerHooks resolve hook work for nested imports - #35169

Merged
bartlomieju merged 1 commit into
mainfrom
fix/register-hooks-nested-resolve
Jun 13, 2026
Merged

bartlomieju merged 1 commit into
mainfrom
fix/register-hooks-nested-resolve

Conversation

@bartlomieju

Copy link
Copy Markdown
Member

A module.registerHooks resolve hook that rewrites specifiers (for example
appending a fragment for HMR-style cache busting) failed on nested imports
with "Loading unprepared module". The module graph is prepared using
deno_graph's own resolution, which doesn't invoke JS resolve hooks, so a
hook-rewritten URL for a nested import was never present in the graph when
deno_core later requested it.

When a resolve hook is active and the requested specifier is missing from
the graph, the loader now prepares it on demand before loading, the same
best-effort preparation already used for load hook redirects.

Fixes #35163

@bartlomieju
bartlomieju merged commit 44c03c9 into main Jun 13, 2026
136 checks passed
@bartlomieju
bartlomieju deleted the fix/register-hooks-nested-resolve branch June 13, 2026 07:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TypeError: Loading unprepared module with registerHooks

1 participant