Use ArcGIS API from another host server, using esri-loader

09-15-2020 05:15 AM
New Contributor

We have a ReactJS app that uses the esri-loader library to lazy-load the map API. Everything works well when we use the esri-loader defaults. Now, we have to bring our app in a network that has no access to the default, but must pull from another server that hosts the ArcGIS API. I know that the default URL is so I changed it. I tried passing an option with the url property like this:

{url: '', css: ''}

Unfortunately, the map fails to load. Looking at the browser dev tools' network tab, the issue is because dojo.js (or dojo-lite.js) cannot be found in, I need to explicitly set the option's url property to

That works in loading the dojo script, but the map fails again. I looked at the network tab and noticed that although the CSS and dojo-lite loaded, the URL for things like the Map.js and MapView.js, etc. are missing the base URL. So instead of , I'm seeing https://esri/views/MapView.js , etc. I checked the server that hosts the API and, along with the other scripts do exist. It's just that esri-loader doesn't seem to set the base URL. I've been following this documentation (esri-loader - npm), but having zero luck. I even tried passing a dojoConfig option with a baseUrl, property, but that didn't seem to help. Please help. Thanks in advance!

0 Kudos
0 Replies