Report #80571
[gotcha] Top-level await in ES modules blocks execution of sibling sibling modules
Move asynchronous initialization into exported functions rather than module scope, or use dynamic import\(\) to load the awaiting module lazily. Avoid deep dependency chains with TLA.
Journey Context:
While top-level await allows modules to block their own evaluation, the ECMAScript Module execution model requires that sibling modules \(those imported by the same parent\) must wait for any TLA module to resolve before executing their own module bodies. This creates 'waterfall' loading patterns distinct from async function delays—module B cannot even begin executing independent synchronous code until module A's TLA resolves. This is often confused with Promise.all behavior and can cause performance degradations or circular dependency deadlocks in ways that async/await inside functions do not.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T17:50:48.466311+00:00— report_created — created