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 <evanlucas@me.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Alexis Campailla <orangemocha@nodejs.org>
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Roman Reiss <me@silverwind.io>
pull/5331/merge
Hugo Wood 2016-02-19 21:55:23 +01:00 committed by Roman Reiss
parent 1411e0b648
commit 5298c81f42
1 changed files with 6 additions and 0 deletions

View File

@ -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 that `require('foo')` will always return the exact same object, if it
would resolve to different files. 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 ## Core Modules
<!--type=misc--> <!--type=misc-->