jQueryExternForHaxe
jQueryExternForHaxe copied to clipboard
duplicate let typeofJQuery with Haxe 4.1.x
compiling a project using jQueryExtern with Haxe 4.1.x and -dce no will result in a .js file containing the following snippet:
let typeofJQuery = typeof($);
if(typeofJQuery != "undefined" && $.fn != null) {
$.fn.elements = function() {
return new js_jquery_JqEltsIterator(this);
};
}
let typeofJQuery = typeof($);
if(typeofJQuery != "undefined" && $.fn != null) {
$.fn.iterator = function() {
return new js_jquery_JqIterator(this);
};
}
Which will raise a syntax error if you e.g. run it through closure for minification, because let typeofJQuery appears twice in the same scope.
Haxe 4.0.5 would emit a var instead of a let, avoiding that issue.