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
But esbuild should realize that there's not actually any top-level await there, because the await is unreachable.
This detail not being supported makes it a bit more annoying to create a module that works in different environments but that top-level awaits in only one of them.
The text was updated successfully, but these errors were encountered:
fabiospampinato
changed the title
Top-level await detection doesn't take into account tree-shaking
Top-level await detection doesn't take into account dead code elimination
Jan 20, 2023
Interesting suggestion. I can't think of any negative consequences of doing this, so I think this sounds reasonable.
Edit: Well, I think it should probably still be respected for the purposes of making the file be considered an ES module. So that means no module or exports and also implying strict mode.
Trying to bundle the following code throws:
But esbuild should realize that there's not actually any top-level await there, because the await is unreachable.
This detail not being supported makes it a bit more annoying to create a module that works in different environments but that top-level awaits in only one of them.
The text was updated successfully, but these errors were encountered: