From 3106297037ae6f9f2b4620ad00556acdc9bf3925 Mon Sep 17 00:00:00 2001 From: Hugo Wood Date: Fri, 19 Feb 2016 21:55:23 +0100 Subject: [PATCH] doc: `require` behavior on case-insensitive systems This adds a paragraph in the Module Caching Caveats section about the behavior of require when Node is running on top of a file system (e.g. HFS) or operating system (e.g. Windows) that will not consider the case of file paths to find files. Reviewed-By: Evan Lucas Reviewed-By: James M Snell Reviewed-By: Alexis Campailla Reviewed-By: Rod Vagg Reviewed-By: Roman Reiss --- doc/api/modules.markdown | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/api/modules.markdown b/doc/api/modules.markdown index bd715f9fecaefc..4c4cacbaf68ac1 100644 --- a/doc/api/modules.markdown +++ b/doc/api/modules.markdown @@ -212,6 +212,12 @@ module (loading from `node_modules` folders), it is not a *guarantee* that `require('foo')` will always return the exact same object, if it would resolve to different files. +Additionally, on case-insensitive file systems or operating systems, different +resolved filenames can point to the same file, but the cache will still treat +them as different modules and will reload the file multiple times. For example, +`require('./foo')` and `require('./FOO')` return two different objects, +irrespective of whether or not `./foo` and `./FOO` are the same file. + ## Core Modules