From 3946824646da18303385e15369571454ee8a79e1 Mon Sep 17 00:00:00 2001 From: Denys Otrishko Date: Wed, 29 Jan 2020 21:12:59 +0200 Subject: [PATCH 1/3] doc: clarify require() OS independence --- doc/api/modules.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/api/modules.md b/doc/api/modules.md index a8f9a60a683382..1ed965b2a032cb 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: From d4f19c6aca51b6c85564626503d7dddfe7adf071 Mon Sep 17 00:00:00 2001 From: Denys Otrishko Date: Thu, 30 Jan 2020 16:32:13 +0200 Subject: [PATCH 2/3] fixup! doc: clarify require() OS independence --- doc/api/modules.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/modules.md b/doc/api/modules.md index 1ed965b2a032cb..1df72673ea066b 100644 --- a/doc/api/modules.md +++ b/doc/api/modules.md @@ -624,7 +624,7 @@ Windows in the same way they would on Unix systems. ```js // Importing a local module with a path relative to the `__dirname` or current -// working directory (on Windows this would resolve to .\\path\\myLocalModule): +// working directory (on Windows this would resolve to .\path\myLocalModule): const myLocalModule = require('./path/myLocalModule'); // Importing a JSON file: From 6343f0cfce820a2317d08a1194ccb0f77225fe54 Mon Sep 17 00:00:00 2001 From: Denys Otrishko <9109612+lundibundi@users.noreply.github.com> Date: Fri, 31 Jan 2020 19:07:08 +0200 Subject: [PATCH 3/3] fixup! Update doc/api/modules.md Co-Authored-By: Rich Trott --- doc/api/modules.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/modules.md b/doc/api/modules.md index 1df72673ea066b..cccd4420e3a629 100644 --- a/doc/api/modules.md +++ b/doc/api/modules.md @@ -624,7 +624,7 @@ Windows in the same way they would on Unix systems. ```js // Importing a local module with a path relative to the `__dirname` or current -// working directory (on Windows this would resolve to .\path\myLocalModule): +// working directory. (On Windows, this would resolve to .\path\myLocalModule.) const myLocalModule = require('./path/myLocalModule'); // Importing a JSON file: