[dojo-contributors] Module formats for the browser

James Burke jburke at dojotoolkit.org
Fri Mar 26 12:44:48 EDT 2010


On Fri, Mar 26, 2010 at 9:29 AM, Kris Zyp <kzyp at dojotoolkit.org> wrote:

> In my proposed migration path, I suggested adding RequireJS and
> retaining dojo.require support for 1.x. How does that break backwards
> compatibility? Perhaps I should have explicitly stated that as a
> corrolary to keeping dojo.require that we also need to retain our global
> namespaces. I think we could move to defining modules with something
> like this for 1.x:

Instead of mixing both loader schemes in one file, I like providing a
RequireJS-converted Dojo 1.x release alongside the normal release.
This is actually what I use for Raindrop -- a converted Dojo that uses
RequireJS as the loader. I still have the regular Dojo loader code in
there. Rawld Gill was doing some more experiments to even remove that
loader, but I believe he got busy with work.

The conversion process I use now has some manual steps. I would be OK
for the 1.x code putting in build pragmas to make those manual steps
automatic with the RequireJS build, and we would need to rework the
requireIf usage particularly in dojox.gfx. With that, maybe have the
build pragmas strip out the regular Dojo loader.

So those are steps I would allow for conversion: provide a sister
build of Dojo that just uses RequireJS in the Dojo 1.x timeframe, that
is enabled by some build pragmas and requireIf changes.

It does mean you cannot mix the two loaders, but I think that is fine,
given the type of change.

How does that sound?

I am not sure how a raw CommonJS module loader would plug in yet, so
that is hard for me to see, like how it could live in dojox for
example.

Aside: my criticisms of the CommonJS stuff are about some fundamental
choices in the module spec. I do appreciate what they have
accomplished so far -- trying to get lots of different people to
develop in the same general direction is extremely hard, and they
deserve some credit for getting something going. It is just hard for
me to get on board when I disagree with the fundamental choices in the
module spec.

James


More information about the dojo-contributors mailing list