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
Due to the var hoisting behavior, Symbol is undefined then exports[Symbol.toStringTag] = 'Module'; is executed.
This my seem like a very niche case but the actual code was found in lodash-es. i.e. if the user tries to bundle lodash-es with the above options they will run into the same error.
Possible Fixes
Make Symbol a reserved variable name (i.e. always consider it already declared) so that var Symbol in user code is rewritten to var Symbol$1 or something similar.
The text was updated successfully, but these errors were encountered:
Of course there are no issues with Polyfills as they all appear to first identify the global object and operate on that. Fix at #3971. This also avoids the same problem for Object and Promise, which Rollup also relies on for various things.
The bug occurs when combining the following:
-f cjs
var Symbol = ...
Expected Behavior
Generated code should work.
Actual Behavior
The generated code:
Due to the
var
hoisting behavior,Symbol
isundefined
thenexports[Symbol.toStringTag] = 'Module';
is executed.This my seem like a very niche case but the actual code was found in
lodash-es
. i.e. if the user tries to bundlelodash-es
with the above options they will run into the same error.Possible Fixes
Make
Symbol
a reserved variable name (i.e. always consider it already declared) so thatvar Symbol
in user code is rewritten tovar Symbol$1
or something similar.The text was updated successfully, but these errors were encountered: