Rich-Harris / butternut

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

Bug: Brace handling inside switch statements #136

Closed loilo closed 7 years ago

loilo commented 7 years ago

From trying to squash docxtemplater.

Butternut does not compensate for removed braces with a semi-colon inside switch statements.

Input:

switch ( any_value ) {
  case 1:
    if ( any_condition ) {
      any_fn_1()
    }case 2:
    break
}

Output Butternut:

switch(any_value){case 1:any_condition&&any_fn_1()case 2:break}

Output UglifyJS:

switch(any_value){case 1:any_condition&&any_fn_1();case 2:}