Shazwazza / ClientDependency

DEPRECATED. A library for managing CSS & JavaScript dependencies and optimization in ASP.Net
139 stars 65 forks source link

Debug=false breaks some JS #130

Closed kgiszewski closed 7 years ago

kgiszewski commented 7 years ago

Using v1.9.2 on Umbraco Cloud. It breaks when some JS isn't conforming to 'use strict`.

image

image

Quick fix is to disable by compilation debug='true', long term fix is to rummage thru old packages that do not conform to strict js.

Possible to disable the use strict?

kgiszewski commented 7 years ago

Turns out that one JS script had a 'use strict' whilst another had a missing var for a variable. This wasn't CDF's fault :)

Shazwazza commented 7 years ago

CDF isn't smart ;) it doesn't know what strict is and it doesn't generate an AST it's just a very fast forward reading JS parser that knows a few simple rules. In most cases any JS issues that appear after CDF has minified things is due to invalid JS even if those invalid JS items are actually 'valid' under very loose JS rules. A lot of times this shows up because people don't put a semi colon after 'strict' which is actually a requirement. In rare cases though , it's a bug with JSMin which i've been fixing over the years: https://github.com/Shazwazza/JsMinSharp