require('foo')
will get exactly
the same object returned, if it would resolve to the same file.
require('foo')
may not cause the module code
to be executed multiple times. This is an important feature. With it,
partially done objects can be returned, thus allowing transitive
dependencies to be loaded even when they would cause cycles.
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.
Casiano Rodriguez León 2015-01-07