jQuery-QueryBuilder icon indicating copy to clipboard operation
jQuery-QueryBuilder copied to clipboard

Minified Script version is error-ing out

Open YasserJaber opened this issue 9 years ago • 9 comments

Hi, I'm trying to use the minified version of query-builder.standalone.js that I downloaded from http://querybuilder.js.org/ ==> Download button then choose ZIP file. once I start using it I'm getting the below error message on my browser dev console Uncaught TypeError: Cannot set property 'doT' of undefined

but If I use the un-minified version of it, things working fine. can you please advise!

YasserJaber avatar Nov 02 '17 14:11 YasserJaber

The online documentation is using the minified file without issues. If you want more help, setup a jsfiddle showing the issue.

mistic100 avatar Nov 11 '17 17:11 mistic100

Did you resolve this issue? I am also finding this, but with both the minified and non-minified versions.

richardpaynea55 avatar Dec 05 '17 14:12 richardpaynea55

To follow up, this appears to occur in the doT.js portion of the standalone JS file and seems to happen when the doT is minified when refering to global variables. Changing line 177 from _global.doT = doT; to window.doT = doT; did the trick for me.

richardpaynea55 avatar Dec 05 '17 15:12 richardpaynea55

I cannot alter external dependencies I do not reproduce the issue either.

mistic100 avatar Dec 16 '17 16:12 mistic100

To follow up, this appears to occur in the doT.js portion of the standalone JS file and seems to happen when the doT is minified when refering to global variables. Changing line 177 from _global.doT = doT; to window.doT = doT; did the trick for me.

That may have worked, but my mistake was the order of my script imports. It's quite likely that's what was going on.

myieye avatar Jan 10 '19 18:01 myieye

Guys this issue is still there in the latest minified standalone version

weedkiller avatar Mar 03 '19 18:03 weedkiller

I started having this problem again and realised that it was because .NET MVC was re-minifying the script, which somehow broke it. I have no problem with the script if it's run as is.

If you're having the same problem you can bundle it in a Bundle instead of a ScriptBundle.

myieye avatar Mar 03 '19 19:03 myieye

Ok that explains some of the results I see in release build vs no issues in a debug build in .NET MVC

But from here I have no control on how the bundle is minified.

Are you suggesting that I don't include it in a bundle, can you please post a snippet of code on the how to bundle it differently if I have to avoid the redo on minification of the standalone minified lib.

weedkiller avatar Mar 04 '19 00:03 weedkiller

Quoted from your link:

However, if you truly want to show a bundle that is not minified from the bundle route, you’ll need to use “Bundle” and not “ScriptBundle” (or clear the transformations from the ScriptBundle / StyleBundle).

So in MVC, instead of bundling it in a new ScriptBundle bundle it simply in a new Bundle or clear the script bundle transformations (I haven't tried that, but one of the default transformations of a script bundle is apparently minification). E.g: new ScriptBundle().Transforms.Clear()

myieye avatar Mar 04 '19 01:03 myieye