Skip to content

Commit 5298c81

Browse files
hgwoodsilverwind
authored andcommitted
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>
1 parent 1411e0b commit 5298c81

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

doc/api/modules.markdown

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,12 @@ module (loading from `node_modules` folders), it is not a *guarantee*
212212
that `require('foo')` will always return the exact same object, if it
213213
would resolve to different files.
214214

215+
Additionally, on case-insensitive file systems or operating systems, different
216+
resolved filenames can point to the same file, but the cache will still treat
217+
them as different modules and will reload the file multiple times. For example,
218+
`require('./foo')` and `require('./FOO')` return two different objects,
219+
irrespective of whether or not `./foo` and `./FOO` are the same file.
220+
215221
## Core Modules
216222

217223
<!--type=misc-->

0 commit comments

Comments
 (0)