@@ -25,7 +25,7 @@ const {
|
25 | 25 | const assert = require('internal/assert'); |
26 | 26 | const internalFS = require('internal/fs/utils'); |
27 | 27 | const { BuiltinModule } = require('internal/bootstrap/realm'); |
28 | | -const { realpathSync } = require('fs'); |
| 28 | +const fs = require('fs'); |
29 | 29 | const { getOptionValue } = require('internal/options'); |
30 | 30 | // Do not eagerly grab .manifest, it may be in TDZ |
31 | 31 | const { sep, posix: { relative: relativePosixPath }, resolve } = require('path'); |
@@ -273,7 +273,11 @@ function finalizeResolution(resolved, base, preserveSymlinks) {
|
273 | 273 | } |
274 | 274 | |
275 | 275 | if (!preserveSymlinks) { |
276 | | -const real = realpathSync(path, { |
| 276 | +// If you are reading this code to figure out how to patch Node.js module loading |
| 277 | +// behavior - DO NOT depend on the patchability in new code: Node.js |
| 278 | +// internals may stop going through the JavaScript fs module entirely. |
| 279 | +// Prefer module.registerHooks() or other more formal fs hooks released in the future. |
| 280 | +const real = fs.realpathSync(path, { |
277 | 281 | [internalFS.realpathCacheKey]: realpathCache, |
278 | 282 | }); |
279 | 283 | const { search, hash } = resolved; |
|