mistic100 / jQuery-QueryBuilder

jQuery plugin offering an interface to create complex queries
https://querybuilder.js.org
MIT License
1.67k stars 552 forks source link

Why query-builder.standalone.js use define on dot and jquery-extend ? #956

Closed MaxenceMouchard closed 1 year ago

MaxenceMouchard commented 1 year ago

Hey,

I have a problem with 'query-builder.standalone.js' that when we have the define function in our page, he use it to load the files 'dot/doT' and 'jquery-extendext'. (line 288) ->

if (typeof define == 'function' && define.amd) {
    define('query-builder', ['jquery', 'dot/doT', 'jquery-extendext'], factory); // THIS LINE FORCE ME TO HAVE THESE FILE IN MY PROJECT
}
else if (typeof module === 'object' && module.exports) {
    module.exports = factory(require('jquery'), require('dot/doT'), require('jquery-extendext'));
}
else {
    factory(root.jQuery, root.doT);
}

I don't understand why define is used here knowing that 'dot/doT' and 'jquery-extendext' are already defined in this same file. So I have to insert the files in my project so that define can load them when it executes the request to the file.

Am I obliged to have these files in my project ? In this case, why using the standalone. Or am I forced to set my define function to undefined ?

MaxenceMouchard commented 1 year ago

Problem is just because in this file 'query-builder.standalone.js' (line 180), dot is defined like : define('doT', function(){return doT;});

and in the query-builder script part, they are try to resolve dot/doT which is not defined cause its just define as 'doT', so browser make a request and don't found the dependancy ...

you probably just have to change this line :