error(311) Missing dependency jQuery (3.1.0)

0
Hi, I'm in the process of creating a new Mendix widget based on the jQuery plugin 'Fancytree'. According to the post below it should not be a problem using jQuery 3.1.0. https://community.mendix.com/questions/61752/Can-I-use-jQuery-version-3x-for-custom-widgets However when i try to build my application or check my widgets via Mendix I get the following Dojo build errors: error(311) Missing dependency. module: GapplessFancytree/lib/jquery-ui; dependency: jquery error(311) Missing dependency. module: GapplessFancytree/lib/jquery.fancytree-all.min; dependency: jquery error(311) Missing dependency. module: GapplessFancytree/lib/jquery.fancytree.buttonbar; dependency: jquery I don't know if it has anything to do with using jQuery 3.0.1. I tried to test with other jQuery versions but it seems the plugin doesn't like that. How can i solve my build errors? define([ "dojo/_base/declare", "mxui/widget/_WidgetBase", "dijit/_TemplatedMixin", "mxui/dom", "dojo/dom", "dojo/dom-prop", "dojo/dom-geometry", "dojo/dom-class", "dojo/dom-style", "dojo/dom-construct", "dojo/_base/array", "dojo/_base/lang", "dojo/text", "dojo/html", "dojo/_base/event", "dojo/text!GapplessFancytree/widget/template/GapplessFancytree.html", "GapplessFancytree/lib/mxdb-helper", "GapplessFancytree/lib/promise-polyfill", "GapplessFancytree/lib/jquery-3.1.0", "GapplessFancytree/lib/jquery-ui", "GapplessFancytree/lib/jquery.fancytree-all.min", "GapplessFancytree/lib/jquery.fancytree.buttonbar" ], function gftwidgetWrapper(declare, _WidgetBase, _TemplatedMixin, dom, dojoDom, dojoProp, dojoGeometry, dojoClass, dojoStyle, dojoConstruct, dojoArray, dojoLang, dojoText, dojoHtml, dojoEvent, widgetTemplate, mxdbhelper, _promisePolyfill, _jQuery, _jQueryUi, _fancytree, _fancytreeext_buttonbar) { "use strict"; // make a local reference from $ to the jQuery object // This avoids the risk of working with an overwritten jquery library by another plugin // also Unlink jQuery and $ from the global scope var $ = jQuery.noConflict(true);
asked
2 answers
2

If I'm correct you need to change the function declaration in the three files mentioned to point to the actual GaplessFancytree/lib/jquery-3.1.0 file instead of the global jquery reference.

Have a look at https://github.com/mendix/Bootstrap-RTE/blob/master/src/BootstrapRTE/lib/bootstrap-wysiwyg.js#L17

answered
1

Problem solved, the solution is, as Nick mentioned, to change the function declaration. You also need to make a change to the jQeury file.

change this:

if ( typeof define === "function" && define.amd ) { define( "jquery", [], function() { return jQuery; } ); }

into this:

if ( typeof define === "function" && define.amd ) { define( [], function() { return jQuery; } ); }

answered