smoosh icon indicating copy to clipboard operation
smoosh copied to clipboard

Fix missing ending semicolon in UglifyJS output

Open thibaudcolas opened this issue 11 years ago • 0 comments

When files processed with smoosh (UglifyJS) are concatenated to other files, there may be a bug because of a missing semicolon at the end of the compressed output. I encountered this problem when using ded/domready's minified version, which has been created with smoosh.

  • The exact error is: TypeError: (intermediate value)(...) is not a function.
  • Here is a related SO question
  • Here is an archive of the issue in UglifyJS 1 (quite long, but very informative of the pros & cons of adding the semicolon).
  • Here is a fiddle which demonstrates the error with the smoosh output of ded/domready + some example code. The fix is also demonstrated.

The fix is directly taken from the UglifyJS source code. It has to be taken care of in smoosh's code too because smoosh directly uses the UglifyJS v1 API. In UglifyJS, the semicolon is also added after the gen_code(ast) call.

thibaudcolas avatar Oct 15 '14 00:10 thibaudcolas