Custom dojo build

3723
15
04-09-2012 01:02 PM
DavidHollema
New Contributor III
I'm trying to create a custom dojo build.   I've followed the procedures on these 2 helpful resources.


These approaches are very similar.  Question I have is does the resultant layer file include any of the ESRI code resources or simply Dojo defined resources.  For example, can an Esri FeatureLayer or Map class be bundled in that layer file or only dojo code?
0 Kudos
15 Replies
markrobey
New Contributor III
If you follow the method explained in those two links the resultant layer file will contain only the Dojo classes that are referenced by your mapping application (except those that you have chosen to discard). It will also include your Javascript for your mapping application (if you have it, for instance, in one javascript file and listed it as a dependency in the build profile). The ESRI classes will be loaded by:
src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.8"

I too followed this method and it works ok. I encountered a few problems with browser localisation. I haven't tried using the build profile attribute "loader: xdomain" yet. Looks like it might be simpler than my solution which was to override the browser's locale using

dojoConfig = { parseOnLoad: true, locale: "en-gb" }

and then load the dojo localisation resource:
    script type="text/javascript">        dojoConfig = { parseOnLoad: true, locale: "en-gb" }</script
    script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.8"></script
    script type="text/javascript" src="Scripts/PROJECTNAMELyr_en-gb.js"></script
    script type="text/javascript" src="Scripts/PROJECTNAMELyr.js"></script
0 Kudos
MattMoyles
New Contributor III
You can include esri code in your layer. You need to download the source code from the esri customers site (i think). It's kind of hard to find but it's on arcgis.com somewhere.

After that you need to do something like this, and then add the esri namespace to your deps.

prefixes: [
    [ "dijit", "../../dijit" ],
    [ "dojox", "../../dojox" ],
    [ "esri", "../../esri"],
    [ "app", "../../app" ],
    [ "dbp", "../../dbp" ]
  ]


It's not easy, but it can be done!
0 Kudos
markrobey
New Contributor III
Very interesting. I'll try this.
0 Kudos
DavidHollema
New Contributor III
I was told from ESRI that javascript source code (unminified) is not available.  I would love if that statement was wrong and I could build esri code into my layer file.  I tried a build with esri's "built" (minified) code downloaded and saved locally to no avail.  Where exactly is the esri javascript source code on arcgis.com?

You can include esri code in your layer. You need to download the source code from the esri customers site (i think). It's kind of hard to find but it's on arcgis.com somewhere.

After that you need to do something like this, and then add the esri namespace to your deps.

prefixes: [
    [ "dijit", "../../dijit" ],
    [ "dojox", "../../dojox" ],
    [ "esri", "../../esri"],
    [ "app", "../../app" ],
    [ "dbp", "../../dbp" ]
  ]


It's not easy, but it can be done!
0 Kudos
derekswingley1
Frequent Contributor
We don't provide an un-minified version of the API. You can download the API if you'd like to host locally here:  http://help.arcgis.com/en/webapi/javascript/arcgis/help/jshelp/intro_accessapi.html

Which takes you here:  http://resources.arcgis.com/content/web/arcgis-javascript-api-download
0 Kudos
DavidHollema
New Contributor III
And just to confirm, esri code from this un-minified version cannot participate in the dojo build process, correct?

We don't provide an un-minified version of the API. You can download the API if you'd like to host locally here:  http://help.arcgis.com/en/webapi/javascript/arcgis/help/jshelp/intro_accessapi.html

Which takes you here:  http://resources.arcgis.com/content/web/arcgis-javascript-api-download
0 Kudos
derekswingley1
Frequent Contributor
No, you can still do builds.

I haven not personally done it, but the two blog post links you originally posted are talking about doing dojo builds with our already built API.
0 Kudos
DavidHollema
New Contributor III
Those two blog posts do nothing more with the esri builds than create a discard file so dojo code that exists within the esri build isn't duplicated in the resulting layer file.  In actuality, the esri code isn't used at all.  The esri dojo dependencies are simply listed in the dependencies section of the discard layer.  The custom build process does nothing with the esri code.  No esri code is bundled into the resulting layer file as indicated by robeym comments above. 

To clarify, I'm looking for a way to produce a custom build that includes my app's dojo dependencies AND esri dependencies all bundled up in one or a few lean layer file(s).  My goal is to limit the http chattiness between my app and the dojo/esri resources it needs to speed up my application.  I have a working custom build which limits chattiness for dojo resources but is still very chatty for esri resources.  My understanding is I need esri unminified source code to meet that goal.  Is that available from somewhere?  A post above indicates it is, but hard to find.  Again, I already have the minified esri api and know how to download that from the resource center.  I'm looking for the true unminified source.

No, you can still do builds.

I haven not personally done it, but the two blog post links you originally posted are talking about doing dojo builds with our already built API.
0 Kudos
derekswingley1
Frequent Contributor
To clarify, I'm looking for a way to produce a custom build that includes my app's dojo dependencies AND esri dependencies all bundled up in one or a few lean layer file(s).


This is not possible. We currently do not provide un-minified source for the API.

You can do a build of your own code but not of the JS API. We are still working on a way to make this possible do not have anything available at this time.
0 Kudos