Module loader dependency trees

Guy Bedford guybedford at
Wed Jun 26 17:22:14 PDT 2013


One very useful feature in RequireJS is the ability to hook into the
dependency tree through the onResourceLoad API.

Currently, the way the link function is designed for ES6 modules, there is
no way for a loader to discover the imports for a given module.

If there was some way to allow some insight into the link output (since
internally the link object with the import list is constructed anyway),
this would be incredibly useful for using the loader to construct
dependency graphs.

Perhaps, simply allow the custom loader to call the native link function
with something like the following:

new Loader({
  link: function(name, source) {
    return, source);

where is the native linking function exposed through the Loader
global. This way the link output can be intercepted and used to create a
dependency tree.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list