What is @babel/plugin-syntax-top-level-await?
The @babel/plugin-syntax-top-level-await package allows Babel to parse top-level await expressions. This is particularly useful for enabling asynchronous module loading directly at the top level of your modules, without needing to wrap them in async functions. It's a syntax-only plugin, meaning it allows Babel to understand this syntax but does not transform it. This is useful for environments that support top-level await natively.
Parsing top-level await expressions
Enables Babel to parse top-level await expressions, allowing for direct, asynchronous operations at the module level without wrapping in an async function.
await fetch('https://example.com/data');