I have a modification to the packer so that it can "fix function". In BLOCKED SCRIPT
var a = function () {
}
Should really be:
var a = function () {
};
this is because you are setting a to an unnamed function. So I came up with this code:
function_fix: function (script) {
var list=[];
script.replace(/(=function)/g, function (rep, Something, place, str, s) {
str = str + '';
var b=0,c;
for(var a = place;a<str.length;) {
var op = str.indexOf('{', a);
var cl = str.indexOf('}', a);
if(cl < 0){ throw "Not Balanced"; return;}
if(op < cl && op > -1) { // open is next
c = true;
b++;
a = op+1;
}else{
b--;
a = cl+1;
}
if(b == 0 && c == true) break;
}
a--;
if(script[a+1] != ";" && script[a+1] != ",") // fix for: var a=function () {}, b=function(){};
list.push(a+list.length);
return str;
});
while(list.length) {
var a = list.shift();
var befor = script.substring(0, a+1), after = script.substring(a+1);
script = befor + ";" + after;
}
return script;
},
Just add it after the pack function in Packer.js and change
script = this.minify(script + "
");
script = this.function_fix(script);
if (shrink) script = this._shrinkVariables(script);
The code will fix function and reduces the number of time that I see a missing ; error when I have packed my code