Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup tree shake removes all fn arguments when using object spread operator #3652

Closed
Filipoliko opened this issue Jun 30, 2020 · 1 comment · Fixed by #3654
Closed

Rollup tree shake removes all fn arguments when using object spread operator #3652

Filipoliko opened this issue Jun 30, 2020 · 1 comment · Fixed by #3654

Comments

@Filipoliko
Copy link

Filipoliko commented Jun 30, 2020

Expected Behavior

When a function is defined with multiple arguments and the first one is not being used, then once the function is called with arguments passed via object spread operator (fn(...[arg1, arg2])), rollup build (with treeshake: true) should preserve all the arguments.

Actual Behavior

If a function fn(arg1, arg2) {...} is using only arg2 and not arg1, then when it is called using the spread operator fn(...[arg1, arg2]), the rollup build removes all the arguments. It works fine, if you call it without the spread operator fn(arg1, arg2) or disable rollups treeshake configuration.

@lukastaegert
Copy link
Member

Thanks for spotting, fix at #3654

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants