multipleDefine error in dojoLoader

01-07-2015 02:11 PM
New Contributor III

I am working on a js application that uses ArcGIS JS (currently targeting 3.8, referencing through the arcgis cdn).  We have found an issue during internal testing where when the app loads and the dojo require/define chain resolves, periodically the app will fail to load with "multipleDefine" errors being thrown from dojoLoader in esri init.js.  We have a single computer running IE 10 that can easily replicate the error in one or two loads of the page.  Testing on another computer running IE 10 did not provide a replication of the issue.  I have tested on IE 11 as well and was able to replicate a few times over many loads of the app.  This hasn't been enough to go on to track down the cause.

We have a number of custom modules setup with the standard "define" structure.  It appears that when one of these modules loads, a group of the references in the define block fail with the multipleDefine errors.  As an example, there is a custom module that handles the setup and use of a BasemapGallery.  In the case of this module, the errors may occur when loading  'esri/dijit/BasemapGallery', 'esri/dijit/BasemapLayer', 'esri/dijit/Basemap', among others.  These 3 references in particular are only made within this single module in our entire app.

Any thoughts about what could be causing this issue?



















], function (declare, _WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, lang, DropDownButton, DropDownMenu, MenuItem, array, functional, template, BasemapGallery, BasemapLayer, Basemap, registry, ArcGISTiledMapServiceLayer) {

    //anonymous function to load CSS files required for this module

    (function () {

        var css = [require.toUrl("gis/dijit/Basemaps/css/Basemaps.css")];

        var head = document.getElementsByTagName("head").item(0),


        for (var i = 0, il = css.length; i < il; i++) {

            link = document.createElement("link");

            link.type = "text/css";

            link.rel = "stylesheet";

            link.href = css[i].toString();



    } ());

    var customBasemaps = {



    var agolBasemaps = {



    // main basemap widget

    return declare([_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin], {

        templateString: template,

        widgetsInTemplate: true,

        mode: "agol",

        title: "Basemaps",

        mapStartBasemap: "hybrid",

        basemapsToShow: ["hybrid", "satellite", "streets", "topo", "gray", "oceans", "national-geographic", "osm"],

        validBasemaps: [],

        postCreate: function () {



        startup: function () {


            if (this.mode === "custom") {


            } else {






Tags (4)
0 Kudos
14 Replies
New Contributor III

I did had a similar issue lately. In the end it turned out there was a conflict wit jQuery UI loading stand-alone (not as a dojo package). Key is wait for jQuery UI to be loaded (blocked) before firing the DoJo loader.

See ArcGIS Javascript API broken after latest WordPress release

Not sure if this applies to your situation. But just in case...

0 Kudos
Occasional Contributor II

I use this solution to solve my multiple loader issue when using Durandal.  It may help you.  I have a dojo_mod for 3.11

0 Kudos
Occasional Contributor III

What fixed my similar issue is the "defer" keyword.  It makes the JavaScript API run only after everything else has loaded.

<script defer src=""></script>

<script defer type="text/javascript" src="Scripts/gvMap.js"></script>

Frequent Contributor


0 Kudos
New Contributor II

I had this same problem.  By removing

<script src="//" />


The error no longer displayed and the map loaded correctly every time, instead of 50% of the time.

0 Kudos