Repository navigation
fix(core): await cached async modules before resolving dynamic imports - #37098
Open
BlackRam-oss wants to merge 1 commit into
Open
BlackRam-oss wants to merge 1 commit into
BlackRam-oss wants to merge 1 commit into
Conversation
NetOpWibby
pushed a commit
to theende/ende
that referenced
this pull request
Nov 7, 2026
V8 reports `Evaluated` for a module whose async evaluation is still pending. The cached-module fast path in `load_dynamic_import` only checked `pending_dyn_mod_evaluations`, which doesn't cover a statically started evaluation or an async dependency of it, so `import()` of such a module resolved with exports still in TDZ. Async graphs now skip the fast path and wait on the module's evaluation promise; sync graphs keep it. (cherry picked from commit 49a03aaf1ae59c864539c88f510ef0582073826e) Upstream: denoland/deno#37098
BlackRam-oss
marked this pull request as ready for review
November 8, 2026 10:47
This branch has not been deployed
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.
Fixes #37097.
A cached module can have V8 status
Evaluatedwhile its async evaluation promise is still pending. The shortcut only checks dynamic-evaluation records, so a statically evaluated root or an async descendant can expose its namespace too early (including uninitialized exports).Skip this shortcut for async graphs and let the existing evaluation-promise path settle them. Synchronous graphs retain the fast path. No new API, dependency, module graph, or wrapper is introduced.
The regression starts a static graph with host-resolved TLA, imports either its root or its async dependency, checks that the import stays pending, then resolves it and checks the value and cached namespace identity/single evaluation.
Validation performed:
Full monorepo
./x fmt,./x lint, and core tests have not been run locally; keeping this draft pending upstream CI/review. No performance benchmark is claimed: already-settled async graphs also take the general path with this conservative fix.AI assistance: prepared with OpenAI Codex. The checks listed above were actually executed; unrun monorepo checks are explicitly distinguished.