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

"if" condition is incorrectly omitted after minify #810

Closed
runtarm opened this issue Mar 6, 2018 · 0 comments · Fixed by #831
Closed

"if" condition is incorrectly omitted after minify #810

runtarm opened this issue Mar 6, 2018 · 0 comments · Fixed by #831
Labels
bug Confirmed bug
Milestone

Comments

@runtarm
Copy link

runtarm commented Mar 6, 2018

Input Code

if (false) {
  var bar = true;
}
if (bar) {
  alert('bug!');
}

Actual Output

var bar;alert('bug!');

Expected Output

var bar;bar&&alert('bug!');

Details

The if condition is incorrectly removed. The logic is changed.

I know that putting var inside a block scope is definitely a bad practice. I've just tried to minify some legacy codes and encountered this critical issue.

Example: See it here in repl

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

Successfully merging a pull request may close this issue.

2 participants