[GIS] Does the ArcGIS JavaScript API let me build / package the application using Dojo

arcgis-javascript-apiarcgis-serverdojo

I'm currently getting to grips with the new (3.1) ArcGIS JavaScript API and how it bundles Dojo and relies on Dojo's Asynchronous Module Definition (AMD) approach.

I'm familiar with AMD and recently completed a project using Require, Backbone, and OpenLayers in combination – overall a very pleasant experience.

However I'm worried by

  • how tightly-coupled Dojo is with the ArcGIS JavaScript API,
  • that trying to use Require instead of Dojo AMD throws an exception, and
  • that Dojo AMD doesn't seem to have the same user-base and momentum as Require, making it difficult to research / resolve problems without hitting the forums

My main concern is that I will write an ArcGIS JavaScript API application and not be able to build / package it into a single / small number of scripts. This will leave me with an application making 100+ HTTP requests at startup for all of the modules it depends on.

I've seen this article covering 3.0 but it doesn't mention the build process and I believe 3.0 is quite different. I've also seen this piece on building / packaging an application that uses the ArcGIS JavaScript API but the comments suggest this is pre-Dojo 1.7 AMD.

Have ESRI really only half implemented the AMD approach, and in a way that will actually make my application slower? Why can I not find ESRI documentation on building / packaging a JavaScript API-based application?

Any thoughts or experience here would be much appreciated.

EDIT Based on the answers so far it seems that no, ESRI hasn't provided any information on building your Dojo application after inflating the number of scripts involved. It seems the only useful information available is from non-official sources and slightly outdated (enough to cause problems). This leads to me wonder why more people aren't vocal about the API's new improvements / deficiencies

  • am I being too critical / demanding in expecting some more information here?
  • is no one using the latest version of the API?
  • should I use an older version of the API that doesn't depend on AMD?

Best Answer

Since esri does not ship source code you cannot build one layer package with all your classes. You will have to push out the esri api locally or using the CDN and then pull down your layer file. So you will have 2 and then the extra's that esri forgot to bundle or chose not to.

We've put together a discard layer so that you don't duplicate packages within your own built layer file and the esri layer file. This is pre AMD but as you've noticed, AMD is only partially implemented in the current version of the API.

This blog post will outline everything you need to know and the concept will apply for newer versions.

the freenode irc chatroom #dojo has great realtime information if you dont' want to wait around for the forum.

Related Question