jrburke/requirejs — Issue #129: Passing configuration as global variable and using namespaces
Author: johanhil
Created: 2011-10-13 07:29:27+00:00
State: open

I am trying to use the new namespace feature together with passing configuration to requirejs using a global variable, and I'm not sure if this is supported.

My setup is nothing special, I have a namespace called "foo". I try to pass the configuration as described here (the second way): http://requirejs.org/docs/api.html#config
I figured that I should put my configuration in foo.require. However, when I run r.js and have optimize: 'none' in app.build.js, I see that the generated foo.js looks like:
```
var foo;(function () { if (typeof foo === 'undefined') {
foo = {};
/** vim: et:ts=4:sw=4:sts=4
...
foo.requirejs = requirejs;foo.require = require;foo.define = define;
} /* <- this is the bracket ending if ( typeof foo === ...) */
}());
foo.define("require-jquery", function(){});
```

If I understand this correctly, the namespace feature removes any possibility of configuring via global variable. Is this by design or a bug?

Thanks!