node package manager



Find all the dependencies of one or more amd modules and sort them in the correct order, from leaf (module with no dependencies) to root (module which no other module depends on). This is an alternative to the official requireJS optimizer, but is designed as a library, not a stand alone application.

Things it can and can't do

  • find dependencies of a module
  • name anonymous modules
  • sort modules from leaf to root
  • produce source-maps
  • use require config
    • use paths
    • use package
    • use map
  • relative dependencies
  • exclude modules and paths
  • umd/iife declarations
  • commonJS style define
  • plugins


This project tries to find top-level define() calls. If you call it with the option umd: true then it will try to find umd modules where the define call is not top-level. But to accept the define call it will need to be wrapped in an AMD test, like most of the examples on the UMD page. The define call in the following code will be found, and, if anonymous, will be named:

if (typeof define === 'function' && define.amd) {
  define(['b'], factory);
if (typeof define === 'function' && define['amd']) {
  define(['b'], factory);
factory(typeof define === 'function' && define.amd ? define : function(){});