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 default export value is assigned to a variable, which uses the file's name as its variable name. The variable name gets prefixed with _ for most keywords, but somehow arguments is missed, which is in fact invalid in strict mode / module context.
Actually, I don't see a reason why the temp variable needs to use the filename, maybe just use something like _default with conflict postfixes is simpler and safer.
The text was updated successfully, but these errors were encountered:
turns out arguments is not a reserved word, which is what we were looking for, but it is a variable name with special logic attached to it...
Actually, I don't see a reason why the temp variable needs to use the filename, maybe just use something like _default with conflict postfixes is simpler and safer.
There are other situations where those names are helpful and it avoids having a dozen _default with attached numbers in the generated code where it is not clear where they came from.
Rollup Version
2.78.0
Operating System (or Browser)
any
Node Version (if applicable)
any
Link To Reproduction
https://rollupjs.org/repl/?version=2.78.0&shareable=JTdCJTIybW9kdWxlcyUyMiUzQSU1QiU3QiUyMm5hbWUlMjIlM0ElMjJtYWluLmpzJTIyJTJDJTIyY29kZSUyMiUzQSUyMmV4cG9ydCUyMGRlZmF1bHQlMjAlN0IlN0QlMjIlMkMlMjJpc0VudHJ5JTIyJTNBdHJ1ZSU3RCUyQyU3QiUyMm5hbWUlMjIlM0ElMjJhcmd1bWVudHMuanMlMjIlMkMlMjJjb2RlJTIyJTNBJTIyZXhwb3J0JTIwY29uc3QlMjBmb28lMjAlM0QlMjAxJTVDbmV4cG9ydCUyMGRlZmF1bHQlMjAlN0IlN0QlMjIlMkMlMjJpc0VudHJ5JTIyJTNBdHJ1ZSU3RCU1RCUyQyUyMm9wdGlvbnMlMjIlM0ElN0IlMjJmb3JtYXQlMjIlM0ElMjJlcyUyMiUyQyUyMm5hbWUlMjIlM0ElMjJteUJ1bmRsZSUyMiUyQyUyMmFtZCUyMiUzQSU3QiUyMmlkJTIyJTNBJTIyJTIyJTdEJTJDJTIyZ2xvYmFscyUyMiUzQSU3QiU3RCU3RCUyQyUyMmV4YW1wbGUlMjIlM0FudWxsJTdE
Expected Behaviour
The generated code should be valid in strict mode (i.e. modules)
Actual Behaviour
When an entry file contains both named and default exports:
Rollup rewrites them into a single export statement:
The default export value is assigned to a variable, which uses the file's name as its variable name. The variable name gets prefixed with
_
for most keywords, but somehowarguments
is missed, which is in fact invalid in strict mode / module context.Actually, I don't see a reason why the temp variable needs to use the filename, maybe just use something like
_default
with conflict postfixes is simpler and safer.The text was updated successfully, but these errors were encountered: