Typically, you should wrap your modules in define() or add define() at the end of the file if these modules have no dependencies. It seems that all of these modules are jQuery dependent, if not other modules / files.
Since you are not using the standard AMD require() / define() protocol, AMD does not really help you with these modules. If you do not plan to write your own modules using define() , you can use almost any asynchronous loader.
However, there is a way to get curl.js to work with non-AMD modules / files. Use js! plugin. Here is your first block of files translated into js! plugin (note I also added an ".js" ext, which I like to do non-modules on):
// we load the core files first, then get the next block that depends on them curl([ "js!MooTools/Core/mootools-1.2.2-core-jm.js", "js!jQuery/Core/jquery-1.3.2.js" ]).next([ "js!MooTools/mGeneral.js", "js!jQuery/Core/jquery.tools.min.js", "js!jQuery/ThirdPartyPlugIns/jquery.tmpl.js" ]).then(onSuccess, onError);
If any of these files in each array is dependent on each other, you can also use an order suffix for them to ensure that they wait for other files to execute / evaluate (make sure you set the correct cache headers). Actually, the order suffix is the fastest method if there is no problem with caching (mobile browsers add some additional restrictions on file size).
Have there been other error messages? In particular, I would expect curl.js to throw at least one error, except for only "Promise not completed".
Also, check the Network tab (Firebug) or Network tab (Chrome) to check that curl.js is in the right place for the modules.
FWIW, I plan to remove the require โ curl alias. The reason is that the global require function is non-standard (and clearly not standardized in the AMD proposal). I suggest using curl() instead of require() .
curl.js also allows top-level api api to be explicitly entered through the apiName configuration parameter if you really want to use the name "require". :)
<script>curl = { apiName: "require" }; </script> <script src="path/to/curl.js"></script> <script>require(["some/modules"]).then(success, failure);</script>
More FWIW: the standard require usually required only in the module and can be requested by including it in the dependency:
define(["require"], function (require) { require(["another/module"], function (another) {
- John