javascript - Access RequireJS path configuration -


i notice in documentation there way pass custom configuration module:

requirejs.config({     baseurl: './js',     paths: {         jquery: 'libs/jquery-1.9.1',         jqueryui: 'libs/jquery-ui-1.9.2'     },     config: {         'baz': {             color: 'blue'         }     } }); 

which can access module:

define(['module'], function (module) {             var color = module.config().color; // 'blue' }); 

but there way access top-level paths configuration, this?

define(['module', 'require'], function (module, require) {             console.log( module.paths() ); // no method paths()     console.log( require.paths() ); // no method paths() }); 

fyi, not production site. i'm trying wire odd debug/config code inside qunit test page. want enumerate module names have custom path defined. this question touched on issue lets me query known modules, not enumerate them.

i don't believe require exposes anywhere, @ least can't find looking through immense codebase. there 2 ways achieve though. first , obvious define config global variable. second, , closer want, create require plugin overrides load function attach config module:

define({     load: function (name, req, onload, config) {         req([name], function (value) {             value.requireconfig = config;             onload(value);         });     } }); 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -