-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Non-strict-mode-compliant codegen for entry with the name arguments containing mixed exports #4612
Copy link
Copy link
Closed
Labels
Description
Rollup Version
2.78.0
Operating System (or Browser)
any
Node Version (if applicable)
any
Link To Reproduction
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:
export const foo = 1
export default {}Rollup rewrites them into a single export statement:
const foo = 1;
var arguments = {};
export { arguments as default, foo };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.
Reactions are currently unavailable