require-mapper

Maps the project's local modules for an easy require access

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

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

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

Load your module using the map's keys:

_require("my.module")
  
  • 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");