dojoLoader multipleDefine Error when map initialize

6681
6
Jump to solution
04-14-2016 02:37 AM
LeoDeng
Occasional Contributor II

I've used ArcGIS API for JavaScript to display a demo map on my webpage.Firstly, I used the single page without thirdpart libs and the result as expect.However, when embed the map init function to the framework of my project, the error of multipleDefine appears. Even if use the basemap 'streets-navigation-vector' instead of 'streets', the map disappear.

I've tried all the reference methods,regardless the api is local or online, the error still exists. I doubt there's relate between dojo and jquery/knockout or others unexpect, such as Asynchronous Module Definition(AMD) conflict.

--------------------------------------------------------

Error: multipleDefine(...)

src: dojoLoader

vector-tile.js

--------------------------------------------------------

Environment:

ArcGIS API for JavaScript 3.16

jquery-1.11.1.min.js

knockout-3.3.0.debug.js

koExternalTemplateEngine_all.js

--------------------------------------------------------

Reference:

multipleDefine error in dojoLoader.https://community.esri.com/thread/119518

http://dojotoolkit.org/reference-guide/1.9/loader/amd.html

0 Kudos
1 Solution

Accepted Solutions
LeoDeng
Occasional Contributor II

Hi, Robert,

We've solve the problem.

Conclusion:

The ShortCutKeys.js(we defined early) expose an AMD model which contains code “define(ShortCutKeys)” conflicts with esri js api.

And we comment the lines of AMD, everything seems well.

Thank you for your help!

View solution in original post

6 Replies
RobertScheitlin__GISP
MVP Emeritus

Leo,

  Have have you tried the script deffer as suggested in this comment:

https://community.esri.com/thread/119518#comment-469973

0 Kudos
LeoDeng
Occasional Contributor II

Yes, I have tried it, but it's not work in my case.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Leo,

  and you are sure that you have all the other libraries load before you load esri?

0 Kudos
LeoDeng
Occasional Contributor II

Hi, Robert:

I've used

<script defer src="http://localhost/arcgis_js_api/library/3.16/3.16/init.js"></script> just before </head> in index.html. And while basemap choose 'streets', it's works. When replace 'streets' to 'streets-navigation-vector', console error multipleDefine(...).

0 Kudos
LeoDeng
Occasional Contributor II

Robert,

I've tested all the basemap parameters, and the result showd that all the 'non-vector' basemap appear normal. On the contrary, the 'vector' types all get dojoLoader multipleDefine Error. The scripts for test are showd below.

var map = null;
var directions = null;


require([
    //"esri/urlUtils", "esri/map", "esri/dijit/Directions",  // multipleDefine
  "esri/urlUtils", "esri/map",
  "dojo/parser", "dojo/domReady!"
], function(
    //urlUtils, Map, Directions,
  urlUtils, Map,
  parser
)
{
  parser.parse();


  map = new Map($el.find(".map")[0], {
  basemap: "gray",  // OK.["streets","gray","satellite","hybrid","terrain","topo","dark-gray","oceans","national-geographic","osm"]
  //basemap: "streets-navigation-vector",  // dojoLoader multipleDefine Error Set: ["streets-navigation-vector","dark-gray-vector","gray-vector","streets-vector","topo-vector","streets-night-vector","streets-relief-vector"]
  center: [-73.93, 42.814],
  zoom: 14
  });
});

Notice, besides the basemap question, while require the "esri/dijit/Directions", will get the multipleDefine Error, too.

The environment of the browser is Google Chrome Version 49.0.2623.110.

0 Kudos
LeoDeng
Occasional Contributor II

Hi, Robert,

We've solve the problem.

Conclusion:

The ShortCutKeys.js(we defined early) expose an AMD model which contains code “define(ShortCutKeys)” conflicts with esri js api.

And we comment the lines of AMD, everything seems well.

Thank you for your help!