Geographic Information Systems Asked by Josiah on April 2, 2021
I have an existing google maps-driven project that I’m trying to rebuild using Esri’s JS API. Whenever I add the script tags <script src="https://js.arcgis.com/4.0"></script>
to my page, I get Error: multipleDefine
.
How can I debug this error?
Error text (3.16):
init.js:31 Error: multipleDefine(…)
init.js:31 src: dojoLoader
init.js:31 info: Object {pid: "esri", mid: "esri/nls/jsapi_en-us", pack: Object, url: "http://js.arcgis.com/3.16/esri/nls/jsapi_en-us.js", executed: 0…}
Error text (4.0):
init.js:24 Error: multipleDefine(…)
init.js:24 src: dojoLoader
init.js:24 info: Object {pid: "dojo", mid: "dojo/nls/dojo_en-us", pack: Object, url: "http://js.arcgis.com/4.0/dojo/nls/dojo_en-us.js", executed: 0…}
This error is caused by having jquery/jqueryUI loading at the same time from Esri's Dojo configuration and in our script. Per the thread here, putting the Esri script at the bottom of the page after jQuery was done loading removed the error and got everything working.
Future Me revisiting this question - it seems that anything that uses AMD/Require-style define conflicts with dojo's define as implemented in the Esri library. This is particularly notable in module-based libraries, and libraries designed to be used in node.js or the browser. Datatables is a good example, simply removing define from the initial environment/tech check solves the problem. Some libraries might need define renamed if they rely on it without a fallback.
Correct answer by Josiah on April 2, 2021
I had the same issue with Drupal. I was not able to fix it in Drupal but using document ready and putting ArcGIS in the bottom of the footer worked for me.
My issue is that ArcGIS tries to load jQuery itself, but gets the location wrong.
4.18:53 Error: scriptError: https://js.arcgis.com/4.18/dojo/jquery.js
at n (4.18:32)
Answered by phpwebdev on April 2, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP