diff options
author | Denys Otrishko <shishugi@gmail.com> | 2020-01-29 22:12:59 +0300 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2020-02-01 06:05:16 +0300 |
commit | be6596352b2a1b8648dc266b5be81b6a1be180d6 (patch) | |
tree | edd110ff98103551d72c696aaee468c4763ba7f2 /doc/api/modules.md | |
parent | 54c1a09202e68517d826104bad3e8e787d358197 (diff) |
doc: clarify require() OS independence
PR-URL: https://github.com/nodejs/node/pull/31571
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'doc/api/modules.md')
-rw-r--r-- | doc/api/modules.md | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/doc/api/modules.md b/doc/api/modules.md index a8f9a60a683..cccd4420e3a 100644 --- a/doc/api/modules.md +++ b/doc/api/modules.md @@ -618,10 +618,13 @@ Used to import modules, `JSON`, and local files. Modules can be imported from `node_modules`. Local modules and JSON files can be imported using a relative path (e.g. `./`, `./foo`, `./bar/baz`, `../foo`) that will be resolved against the directory named by [`__dirname`][] (if defined) or -the current working directory. +the current working directory. The relative paths of POSIX style are resolved +in an OS independent fashion, meaning that the examples above will work on +Windows in the same way they would on Unix systems. ```js -// Importing a local module: +// Importing a local module with a path relative to the `__dirname` or current +// working directory. (On Windows, this would resolve to .\path\myLocalModule.) const myLocalModule = require('./path/myLocalModule'); // Importing a JSON file: |