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
Operating System (or Browser): Linux / Firefox v64
Node Version: v10.12.0
Rollup seems to rename named exports in some cases when using code splitting (export { var1 as a, var2 as b, ... }, see first Rollup repl link for minimal repro).
This is all fine, but issues arise if one of the chunks contains a huge amount of named exports (in my case, a UI library with icons). After we run out of single letter tokens, Rollup will start using, aa, ab ... and eventually da, db ... do. It seems there's no checks in place that avoid using reserved keywords here such as do, which now occurs in my project. My bundle ends up containing:
import { a as firstExport, b as secondExport, ... dn as IconFavorite, do as IconFavoriteFilled, dp as IconFilledSquare, ... }
^^
which create-react-app chokes on when importing the resulting bundle (Unexpected keyword 'do').
With a huge number of variables (271 to be exact 😄) we can see the problematic output being generated. ctrl+f search for as do or do as in the output and you will spot the problem, which also the repl's syntax highlighting displays as a keyword:
Expected Behavior
Avoid using reserved keywords when renaming named exports
Actual Behavior
Reserved keywords such as do are being used for renamed named exports.
The text was updated successfully, but these errors were encountered:
Thanks for the issue. There is in fact sanitation for regular variable names but not for auto-shortened exports and imports. Should not be too difficult to fix. I am working on a few other things at the moment but it should be possible to sneak in a fix for this soon.
As it turns out, it was really not a lot of effort as I could just re-use your nice test case as an official test and we already have a table of reserved names in the code. Fix at #2768.
Rollup seems to rename named exports in some cases when using code splitting (
export { var1 as a, var2 as b, ... }
, see first Rollup repl link for minimal repro).This is all fine, but issues arise if one of the chunks contains a huge amount of named exports (in my case, a UI library with icons). After we run out of single letter tokens, Rollup will start using,
aa, ab ...
and eventuallyda, db ... do
. It seems there's no checks in place that avoid using reserved keywords here such asdo
, which now occurs in my project. My bundle ends up containing:which create-react-app chokes on when importing the resulting bundle (
Unexpected keyword 'do'
).How Do We Reproduce?
Minimal reproduction of the renaming behavior
repl link
Note how
black
is renamed toa
in the above example.Minimal reproduction of the rename
as do
problemrepl link
With a huge number of variables (271 to be exact 😄) we can see the problematic output being generated. ctrl+f search for
as do
ordo as
in the output and you will spot the problem, which also the repl's syntax highlighting displays as a keyword:Expected Behavior
Avoid using reserved keywords when renaming named exports
Actual Behavior
Reserved keywords such as
do
are being used for renamed named exports.The text was updated successfully, but these errors were encountered: