rexbradford

Why are so many dojo modules pulled in?

Discussion created by rexbradford on Nov 15, 2011
Latest reply on Apr 9, 2012 by mattlane86
I'm wondering if it's possible to reduce the number of unused and unwanted dojo modules being pulled in, to help reduce app load time.

I am explicitly requiring only these 11 modules:

dojo.require("esri.map");
dojo.require("esri.layers.osm");
dojo.require("esri.virtualearth.VEGeocoder");
dojo.require("esri.layers.FeatureLayer");
dojo.require("esri.layers.KMLLayer");
dojo.require("esri.dijit.Scalebar");
dojo.require("esri.toolbars.navigation");
dojo.require("dijit.layout.BorderContainer");
dojo.require("dijit.layout.ContentPane");
dojo.require("dijit.Dialog");
dojo.require("dojox.collections.Dictionary");

so these entries in Firebug's net window are hardly surprising, except maybe the first:

firebug.xd.js
svg.xd.js
jsapi_en-us.xd.js
osm.xd.js
KMLLayer.xd.js
FeatureLayer.xd.js
Scalebar.xd.js
BorderContainer.xd.js
Dialog.xd.js
ContentPane.xd.js
Dictionary.xd.js.

but then look at what keeps coming after those (.xd.js file extensions removed to save room):

iframe, MapImageLayer, Popup, _LayoutWidget, cookie, _ContentPanelResizeMixin, html, loading, TimedMoveable, _FormMixin, DialogUnderlay, _DialogMixin, common, TooltipDialog, PopupBase, Chart2D, base, Tooltip, _Contained, Default, Default (twice!), Invisible, Lines, Areas, MarkersOnly, Markers, Scatter, StackedAreas, StackedLines, Columns, StackedColumns, Bars, ClusteredColumns, StackedBars, ClusteredBars, Pie, Grid, Bubble, Candlesticks, Spider, OHLC, Chart Theme, Tooltip, Base, functional, fold, scan, linear, colors, common, utils, Base, common, Base, reversed, fx, gradutils, sequence, Element, _PlotEvents, primitive, easing, Series, color, Palette, object, lambda, array, common, _base.

There are over 70 in all.  A few dozen seem to be related to charting, which is ironic given:

1. I am using google charts for all charting, and don't try to include any dojo chart tools at all
2. On startup my app prints out two warnings from inside dojo somewhere:
EXPERIMENTAL: dojox.charting.plot2d.Spider -- APIs subject to change without notice.
DEPRECATED: dojox.charting.Chart2D Use dojo.charting.Chart instead and require all other components explicitly -- will be removed in version: 2.0

Does anybody know how to get dojo under control?  I thought the whole idea of Dojo was that it would only bring in stuff that's needed?

Rex Bradford
Direct Relief International

Outcomes