cujojs / curl

curl.js is small, fast, extensible module loader that handles AMD, CommonJS Modules/1.1, CSS, HTML/text, and legacy scripts.
https://github.com/cujojs/curl/wiki
Other
1.89k stars 216 forks source link

curl and compiled modules in one file #106

Closed tmaslen closed 11 years ago

tmaslen commented 11 years ago

Hi,

I'm trying to super optimize my code now. I've stuck curl and then my compiled AMD modules (compiled via r.js) in a single file to see if I can reduce everything to a single HTTP request.

This is my new curl config...

var curl = {
                baseUrl: '<?= $this->hostPath; ?>/js/',
                apiContext: window,
                apiName: 'require'
            };

I'm currently using 0.6.4. This errors with the following message...

"Uncaught Error: duplicate define: config"

We do have a module called "config", but there definitely are no other modules called "config".

Is this actually possible? Maybe I still need a path option in the config?

Thanks as always, /t

unscriptable commented 11 years ago

Yah, ensure you're using paths. Built files need to contain modules with full ids. r.js has to guess at the paths if they're not explicit. curl.js and r.js are probably going to guess differently. :) If you can peek inside the built file, you may be able to see what ids have been assigned.

tmaslen commented 11 years ago

Apologies, this was a user error. My colleague had added a define into the page so we did have two "config"s defined.

/t