[Cosmo-dev] Dojo 0.4.3 and circular dojo.requires
travis at osafoundation.org
Tue Oct 16 16:50:20 PDT 2007
We've recently tried to upgrade from 0.4.1 to 0.4.3 but ran into some
problems related to changes in the Dojo build system. We'd like to
follow up on this experience by attempting to clarify best practices
for 0.4.3 builds.
Our application is large enough that we are utilizing the custom
namespace functionality as follows:
dojo.registerNamespaceManifest("cosmo", "../../cosmo", "cosmo",
where our directory structure looks like:
|- dojo -
Unfortunately, a number of circular require dependencies have worked
their way into the codebase over time. For example:
In all cases the requires are being used at the top of the script
immediately below the appropriate dojo.provide. In most cases,
however, the module they reference is not used during the loading of
the script, but is required for a library function provided within.
The Dojo 0.4.1 build system strips out dojo.requires for files it
includes in the monolithic dojo.js file it creates. This means that
the circular dependencies described above are hidden without causing
errors, since by the time the library functions are used the
appropriate modules have indeed been loaded.
In the 0.4.3 build system, however, these requires are not being
stripped. This is causing problems when dojo.js loads because
dojo.require("cosmo.app.pim") has been packed into the built dojo.js
file before dojo.provide("cosmo.app.pim"). These problems are
actually errors because we have not yet used
registerNamespaceManifest to specify the location of "cosmo" code and
as a result dojo makes requests to the wrong location on the server.
Our questions are as follows:
1) Are we using any of this infrastructure in glaringly incorrect ways?
2) What is considered best practice regarding circular dependencies?
Are they simply unacceptable within the constraints of the Dojo build
system (that is, will the build system ever support them?)
3) Is there a way to re-enabled the stripping of dojo.requires in 0.4.3?
I've included our build profile at the bottom of this email in case
it will help. Please do not hesitate to ask for any more information
that would be useful.
Thank you very much for your time!
Open Source Applications Foundation
var dependencies = [
dependencies.prefixes = [
More information about the cosmo-dev