0.4.7 • Published 11 years ago

include-path v0.4.7

Weekly downloads
8
License
GLPv3
Repository
github
Last release
11 years ago

node-include-path

Inject additional paths to modules.require search path directly in node. This module uses a minimalist approach, manipulating the process.env key NODE_PATH and re-calling the module.js init function.

Install the package. $ npm install include-path

Usage: module(paths)

/*
 *  file server.js
 *
 *  require a path
 *  require('include-path')('./lib');
 *
 *  or alternately
 *  require('include-path')(__dirname+'/lib');
 *
 *  or an array
 *  require('include-path')(['./lib', './library', './extra']);
 */

require('include-path')('./lib');

var myLocalModuleFromLibDirectory = require('myLocalModuleFromLibDirectory');

All tests pass with node -v v0.10.28 All tests pass with node -v v0.10.29