Top-level await incompatible with inlineDynamicImports
Author: guybedfordCreated Jul 12, 2025Updated Aug 11, 2026
Labelst¹ 🐞 bugt⁸ ⋅ triage
Rollup Version
4.450.0
Operating System (or Browser)
repl
Node Version (if applicable)
No response
Link To Reproduction
Expected Behaviour
When using top-level await inside of a module that is imported with dynamic import where that dynamically imported module is inlined, the dynamic import promise should wait for the tla completion of the inlined module.
Actual Behaviour
The "next tick" approach of Promise.resolve() in the dynamic import doesn't factor in the tla time.
A simple fix that would avoid the wrapping refactoring might be to have a callback after the inlined tla module executes, which could be used to trigger the dynamic import promise resolution. Alternatively the wrapper work is likely needed to complete TLA support.
Source: rollup/rollup