Error: multipleDefine from Dojo & jQuery-UI conflict

Allen Cypher picture Allen Cypher · May 9, 2016 · Viewed 8k times · Source

I am trying to create an editable SlickGrid (which uses jquery-ui) and also use Dojo.

When my page contains
<script src="../../bower_components/dojo/dojo.js"></script>
<script src="../../bower_components/SlickGrid/lib/jquery-ui-1.11.3.js"></script>
<script src="../../mlads/fillDemo/FillDemo.js"></script>
the console shows

Error: multipleDefine
return mix(new Error(error), {src:"dojoLoader", info:info});  dojo.js (line 106)
src: dojoLoader   dojo.js (line 1896)
info: Object { pid="dijit",  mid="dijit/_WidgetsInTemplateMixin",  pack={...},  more...}

If I comment out the jquery-ui line, the error goes away.
FillDemo.js is my source code, which starts with

require(
[    "dojo/_base/declare",
     "dijit/_WidgetBase", 
     "dijit/_TemplatedMixin",
     "dijit/_WidgetsInTemplateMixin",
     "dijit/registry",
     "dijit/form/Button", 
     "dijit/form/DropDownButton",

Answer

Corina picture Corina · May 10, 2016

It looks like this is an error with the order in which jQuery UI is loaded vs when the dojo loader is intialized.

See the discussion here for more context: https://geonet.esri.com/message/448542#comment-448449

The solution is to make sure dojo loader is called after jQuery UI and jQuery have loaded. For this, you can move the loading of dojo to the bottom of the HTML page, and leave jQuery and jQueryUI in the header.