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
the created output contains var xx = class ... for every class defined in the source file in addition to the expected export {...}.
Question: is the use of var by intention (e.g. for use in "classical" html pages) or should it better be const to avoid cluttering the global context / window object?
The text was updated successfully, but these errors were encountered:
It's intentional because let/const introduces a "TDZ" Temporal Dead Zone which is fine in theory but in practice caused extreme performance issues in Safari. #478. There was some talk with the WebKit team I think. Ultimately switched everything to var :)
ESM is for modules so the code will run as an ESM import or as a <script type=module ... block, both of which do not clutter the global context/window - you need to explicitly say window.x = to do that.
If you're running the ESM output code in a normal <script> block and are worried about the global context then use format IIFE.
If I run esbuild to generate esm output with the following options:
the created output contains
var xx = class ...
for every class defined in the source file in addition to the expectedexport {...}
.Question: is the use of
var
by intention (e.g. for use in "classical" html pages) or should it better beconst
to avoid cluttering the global context / window object?The text was updated successfully, but these errors were encountered: