The ArcGIS JS API (version 4.1) uses Dojo's implementation of the AMD module loader. I think it's simplest to use AMD modules in custom code too for compatibility. I'd love to be wrong but my understanding is that there's no escaping Dojo and AMD when using the ArcGIS JS API.
As an app grows it will typically require a large number of AMD modules in order to keep things organized. Dojo is going to make a separate http request for each module. There's going to be a lot of http requests on page load which the user will have to wait for.
I've tried concatenating multiple AMD modules into a single file using a js build tool (incidentally brunch.io) but it seems to be causing "multipleDefine" errors.
I'm interested in suggestions for organizing JS code in an app that uses ArcGIS JS API without making a large number of http requests. Wondering how others have solved this?
- Somehow concatenating a large number of AMD modules into a small number of .js files?
- Making their AMD modules very large so they don't need too many modules?
- Tolerating a large number of http requests to fetch all their AMD modules?