Resolve the path of a module like [`require.resolve()`](https://nodejs.org/api/globals.html#globals_require_resolve) but from the current working directory.
4
5
@param moduleId - What you would use in `require()`.
6
@returns The resolved module path.
7
@throws When the module can't be found.
8
9
@example
10
```
11
import resolveCwd = require('resolve-cwd');
12
13
console.log(__dirname);
14
//=> '/Users/sindresorhus/rainbow'
15
16
console.log(process.cwd());
17
//=> '/Users/sindresorhus/unicorn'
18
19
console.log(resolveCwd('./foo'));
20
//=> '/Users/sindresorhus/unicorn/foo.js'
21
```
22
*/
23
(moduleId: string): string;
24
25
/**
26
Resolve the path of a module like [`require.resolve()`](https://nodejs.org/api/globals.html#globals_require_resolve) but from the current working directory.
27
28
@param moduleId - What you would use in `require()`.
29
@returns The resolved module path. Returns `undefined` instead of throwing when the module can't be found.