coderaiser/minify

Incorrect javascript produced for nested single line if..else statements. v10.3.0-v11.0.1

Closed this issue · 1 comments

I encountered an error where incorrect javascript is produced when minifed. Surprisingly it works in 9.2.0
Original code:

let a;
let b;

if (a) {
  if (b) {
    console.log("a and b are truthy");
  } else {
    console.log("a is truthy, b is falsy");
  }
}

Incorrect code (v10.3.0-v11.0.1). If a is falsy, then console.log("a is truthy, b is falsy")' gets triggered incorrectly.

let a;
let b;
a && b
  ? console.log("a and b are truthy")
  : console.log("a is truthy, b is falsy");

Correct code (v9.2.0)

let a, b;
a &&
  (b
    ? console.log("a and b are truthy")
    : console.log("a is truthy, b is falsy"));

Just fixed in @putout/minify@3.7.0, please re-install Minify, is it works for you?