node-resolve

Locate modules using the Node resolution algorithm, for using third party modules in node_modules

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
node-resolve
001.3.44 years ago7 years agoMinified + gzip package size for node-resolve in KB

Readme

node-resolve
!NPM versionnpm-imagenpm-url !Downloadsdownloads-imagenpm-url !Build Statustravis-imagetravis-url !Dependency statusdavid-dm-imagedavid-dm-url !Dev Dependency statusdavid-dm-dev-imagedavid-dm-dev-url !Coverage Statuscoveralls-imagecoveralls-url
Locate modules using the Node resolution algorithm, for using third party modules in nodemodules.
v1.3.x breaking change, you have to pass a 'cwd' to resolve, '.' is default.
var nodeResolve = require('node-resolve');

nodeResolve.resolve('src/index.js', './foo/foo', '.');// src/foo/foo.js
nodeResolve.resolve('src/index.js', 'babel-core', '.');// node_modules/babel-core/index.js

undefined is returned if not found, and null is returned if it's a builtin module(fs,path...).
node-resolve supports browser spec
.
nodeResolve.resolve('src/index.js', 'inherits', '.', true)// inherits_browser.js
nodeResolve.resolve('src/index.js', 'fs', '.', true)// undefiend