1

Complete error logs

I am using angular 1.6 and argis 4.4 for loading esri-map. I used 'defer' keyword for loading 'angular-esri-map.js', but it did not work. I am able to render esri-map successfully in SPA application. But when i am trying to integrate it in our enterprise application is just breaks.

I am loading js in following way=>

        <script src="assets/angular.js"></script>
        <script src="https://js.arcgis.com/4.4/"></script>
        <script defer src="assets/angular-esri-map.js"></script>

Following dependencies i have added in our application=>

    'ngAnimate',
    'ngCookies',
    'ui.router',
    'esri.map',
    'ngSanitize',
    'ngTouch',
    'angular-carousel',
    'd3'    

Following image shows logs where it is breaking=>

It would be great help if someone helps to fix this 'multipleDefine' dojoloader error.

Sachin Ambalkar
  • 353
  • 2
  • 7
  • I was getting this error after upgrading arcgis v4. I still had a script tag to load v3. Removing it resolved the issue for me. – brt Dec 30 '22 at 18:23

1 Answers1

0

I think the dojo AMD loader has a conflict with another loader. But there is a way to prevent this. The following code 'moves' the conflicting Dojo amd loader to a another temporary method, and after all other scripts are loaded, this is restored.

Add this just after dojo.js is loaded on the page (in the head):

<script type="text/javascript">if (typeof define === 'function' && define.amd) {if(define.amd.vendor =='dojotoolkit.org'){define._amd = define.amd;delete define.amd;}</script>

And then load all other script like you have added in your question. Then when all scripts are loaded, add this script:

<script type="text/javascript">if (typeof define === 'function' && define._amd) {define.amd = define._amd; delete define._amd;}</script>

After this everything should work correctly.

Ferry Kranenburg
  • 2,625
  • 1
  • 17
  • 23