You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 9f6a084
Browse filesBrowse the repository at this point in the historyBrowse files
fix(defer): build a deferred namespace for an async module (#21871)
* fix(defer): build a deferred namespace for an async module
`import defer` of a module with top-level await was treated as a plain
import, so no deferred namespace existed and forcing it during the module's
own evaluating-async state returned exports instead of throwing a TypeError.
The phase alone now decides, and the eager evaluation the spec requires for
such a module is unchanged.
Two things fall out of that. A module deferring itself must not be awaited
as its own async dependency, which would probe the namespace and force the
evaluation it must not trigger. And `deferredModuleAsyncTransitiveDependencies`
is now declared where it is emitted, and mapped to the async module runtime
that defines it, instead of relying on another module pulling that runtime in.
* fix(defer): keep an async external undeferred
`configCases/externals/phase-imports-defer` pins that `import defer` of an
already-async external stays a plain import. An external is a promise webpack
awaits, not a module record with an evaluating state, so a deferred namespace
for one can never throw and only costs bytes. Deferring now follows the phase
for modules webpack evaluates and leaves async externals alone.
* docs: shorten the async-external helper comment
* docs: drop the helper JSDoc for a one-line comment
0 commit comments