doc: document module.path

Refs: https://github.com/nodejs/node/pull/26970
Fixes: https://github.com/nodejs/node/issues/33270

PR-URL: https://github.com/nodejs/node/pull/33323
Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit is contained in:
Antoine du Hamel
2020-05-09 13:02:47 +02:00
committed by Anna Henningsen
parent 38f444060b
commit a82001a387

View File

@@ -688,6 +688,7 @@ node entry.js
```js
Module {
id: '.',
path: '/absolute/path/to',
exports: {},
parent: null,
filename: '/absolute/path/to/entry.js',
@@ -899,6 +900,16 @@ added: v0.1.16
The module that first required this one.
### `module.path`
<!-- YAML
added: v11.14.0
-->
* {string}
The directory name of the module. This is usually the same as the
[`path.dirname()`][] of the [`module.id`][].
### `module.paths`
<!-- YAML
added: v0.4.0
@@ -1110,6 +1121,7 @@ consists of the following keys:
[`__filename`]: #modules_filename
[`createRequire()`]: #modules_module_createrequire_filename
[`module` object]: #modules_the_module_object
[`module.id`]: #modules_module_id
[`path.dirname()`]: path.html#path_path_dirname_path
[ECMAScript Modules]: esm.html
[an error]: errors.html#errors_err_require_esm