ClientDependency icon indicating copy to clipboard operation
ClientDependency copied to clipboard

JS multiline comment is interpreted as unclosed regex

Open adrianstas opened this issue 7 years ago • 1 comments
trafficstars

Hi

While trying minify the following file: https://github.com/DataTables/DataTables/blob/master/media/js/jquery.dataTables.js

The following exception is occuring: 'System.Exception: Error: JSMIN Unterminated set in Regular Expression literal'

Probably you don't escape multiline comments properly.

Here's the wrong interpretation: image

Adrian

adrianstas avatar Apr 20 '18 08:04 adrianstas

the minifier isn't smart, it's just fast. It doesn't produce an AST for minification so there are some edge cases where odd things will break it.
I won't have much time to look into this very soon, your best bet is to remove this syntax. The minifier relies on an updated version of JsMin which i've been fixing over the years to support these odd edge cases, you can find it here: https://github.com/shazwazza/jsminsharp but it's a nightmare to debug (you should see the original!)

Shazwazza avatar May 03 '18 13:05 Shazwazza