mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
de1dc0ae2e
Currently, required modules use the real location of the package/file as their __filename and __dirname, instead of the symlinked path if it exists. This behaviour is undocumented (it even goes against documentation in certain scenarios), creating hard-to-debug problems for developers who wish to leverage filesystem abstractions to lay out their application. This patch resolves all required modules to their canonical path while still preserving any symlinks within the path, instead of resolving to their canonical realpath. The one special case observed is when the main module is loaded -- in this case, the realpath does need to be used in order for the main module to load properly. PR-URL: https://github.com/nodejs/node/pull/5950 Reviewed-By: James M Snell <jasnell@gmail.com>
3 lines
66 B
JavaScript
3 lines
66 B
JavaScript
exports.dep1 = require('dep1');
|
|
exports.dep2 = exports.dep1.dep2;
|