I can think of two ways to do this:
Instead of giving an object literal to
require.config
, put the configuration you give to RequireJS in a well known location and pass it to the multiple config calls you need to do:window.myapp_requirejs_config = { baseUrl: ... }; require.config(window.myapp_requirejs_config);
The
require.config
call could be repeated in different contexts and use the same object. This won't work if you have RequireJS combine configurations and want to be able to use the configuration that RequireJS uses once they are all combined. However, doing things this way does not run the risk of unexpected breakage because it relies only on documented and public parts of RequireJS.The configuration you give to RequireJS is located at
requirejs.s.contexts.<context name>.config
where<context name>
is the name of the RequireJS context. The default context is named_
so the configuration for it would berequirejs.s.contexts._.config
. However, this is not part of the public API and can change at any time.