Rich-Harris / butternut

The fast, future-friendly minifier
https://butternut.now.sh
MIT License
1.17k stars 17 forks source link

Unused declarations should not be mangled #55

Closed Rich-Harris closed 7 years ago

Rich-Harris commented 7 years ago

Repro:

// input
(function () {
  var foo = 1, bar = 2, baz = 3;
  console.log(baz);
}());

// expected
!function(){var a=3;console.log(a)}()

// actual
!function(){var c=3;console.log(c)}()

Having a and b assigned to unused vars means we get to aa etc sooner, increasing output size.