2

Over the last few years, my team has developed a web app with web maps using ArcGIS JS version 3. We opted to use the CDN (script src https://js.arcgis.com/3.36/) instead of hosting the entire SDK ourselves.

Over the last few years, we have built up quite a number of dojo templated widgets that integrate with the ArcGIS map, and just recently have began to notice that our page loads are really slowing down quite a lot because the web browser is initiating an HTTP request for every single module.

I'm been searching for a way to reduce the number of HTTP requests on page load, and the only suggestions I have been able to find are to use the Dojo build system. I've been looking into the dojo build system, but it seems very complicated to get ArcGIS JS included in the mix.

This is the only decent example I've been able to find so far that isn't outdated: https://github.com/Esri/jsapi-resources/tree/master/3.x/bower/dojo

With this example project, the "dist" folder after building ends up being over 300MB in size. It seems to be including all of the dojo libraries as well as the ESRI libraries. I am trying to avoid hosting all of that.

Is there any way possible for the dojo build system to only build our "custom" AMD modules and still use the ESRI ArcGIS CDN at the same time or is something like that impossible?

1

The Dojo build tools don't really allow to remove unused files. You get the built layers, and optimized files along with any files that may be needed. If you wanted to, you could watch the network traffic of your application during use, make note of what is used, and write a script to try and remove files you can verify are not used at runtime. This is a little tricky, so try not to be too aggressive in what you remove.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.