resolve-cwd
Advanced tools
Resolve the path of a module like `require.resolve()` but from the current working directory
Weekly downloads
Changelog
Breaking:
undefined
instead of null
when the module can't be found when using resolveCwd.silent()
(#4) b070276Enhancements:
https://github.com/sindresorhus/resolve-cwd/compare/v2.0.0...v3.0.0
Readme
Resolve the path of a module like
require.resolve()
but from the current working directory
$ npm install resolve-cwd
const resolveCwd = require('resolve-cwd');
console.log(__dirname);
//=> '/Users/sindresorhus/rainbow'
console.log(process.cwd());
//=> '/Users/sindresorhus/unicorn'
console.log(resolveCwd('./foo'));
//=> '/Users/sindresorhus/unicorn/foo.js'
Like require()
, throws when the module can't be found.
Returns undefined
instead of throwing when the module can't be found.
Type: string
What you would use in require()
.
MIT © Sindre Sorhus
Resolve the path of a module like `require.resolve()` but from the current working directory
The npm package resolve-cwd receives a total of 18,399,793 weekly downloads. As such, resolve-cwd popularity was classified as popular.
We found that resolve-cwd demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.It has 1 open source maintainer collaborating on the project.