node package manager
Don’t reinvent the wheel. Reuse code within your team. Create a free org »

require-mapper

require-mapper

Maps the project's local modules for an easy require access.
With simple key value mapping, the project's modules can be addressed more easily

Usage

Just map your modules

var Mapper = require("require-mapper"),
        mapper = new Mapper();

mapper.map({
    "my.module": "src/My.js"
});

And then...

Load your module using the map's keys:

_require("my.module")
  

Customize on initial phase (optional)

  • methodname - The method name to be used for require the modules
  • basepath - The base path for resolving the modules (default: ".")
  • data - The modules map
var Mapper = require("require-mapper"),
        mapper = new Mapper();

mapper.init({
    methodname: "requirexxx"
    basepath: "../",
    data:{
        "foo.module": "src/foo/Foo.js"
    }
});

// use your custom require method name
requirexxx("foo.module");