Error: multipleDefine from Dojo & jQuery-UI confli

2019-04-29 20:53发布

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",

1条回答
太酷不给撩
2楼-- · 2019-04-29 21:32

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.

查看更多
登录 后发表回答