jrburke/almond — Issue #4: "The modules must be optimized in order"
Author: pmuellr
Created: 2011-12-07 13:44:39+00:00
State: open

From the [README](https://github.com/jrburke/almond/blob/master/README.md) file:

The modules must be optimized in order, so common dependencies,
modules with no dependencies are first in the file.

Is this a limitation of almond, or a semantic issue with AMD? When I ran into this problem (my modules were not listed in pre-req happy order), debugging it, I could see that the define() calls actually seemed to be *loading* the module as well. Is that just an 'optimization' for almond, or the way AMD is supposed to work?

If it's a semantic of AMD that modules are loaded during `define()`, I guess AMD isn't the tool I'm looking for. But if it's just an optimization for almond, that can be *fixed*.

Here's my use case. I have a wad of AMD modules. I have almond. I want to package all that up in a single file, quickly. Basically using `cat`. Include this file in an .html file, and then require() away to get to the modules.

Unfortunately, getting this to work would require me to append the AMD modules in pre-req order, which is something I don't want to have to deal with. This is needed for my continuous dev build, so using an optimizing build isn't the right tool; again, think `cat` as the build tool of choice here.