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

Try/catch not tree-shaken if containing empty statement #3161

Closed
stephanedr opened this issue Oct 15, 2019 · 4 comments · Fixed by #3166
Closed

Try/catch not tree-shaken if containing empty statement #3161

stephanedr opened this issue Oct 15, 2019 · 4 comments · Fixed by #3166

Comments

@stephanedr
Copy link

  • Rollup Version: 1.24.0
  • Operating System (or Browser): Linux
  • Node Version: 10.16.3

How Do We Reproduce?

With tryCatchDeoptimization=false.

try {
    ;
}
catch (e) {
}

This code is generated after plugin stripping code.

Expected Behavior

Completely removed.

Actual Behavior

Generates:

try {
}
catch (e) {
}

Workaround: run rollup a 2nd time to remove it.

@lukastaegert

This comment has been minimized.

@lukastaegert

This comment has been minimized.

@lukastaegert
Copy link
Member

Oh sorry, I did not read properly, you already used the flag

@lukastaegert
Copy link
Member

Good point, the logic was slightly tailored towards the tryCatchDeoptimization: true case. Now the false case will properly look for side-effects in #3166.

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