diff options
author | ZYSzys <zyszys98@gmail.com> | 2019-12-07 21:19:57 +0800 |
---|---|---|
committer | Beth Griggs <Bethany.Griggs@uk.ibm.com> | 2020-02-06 02:49:28 +0000 |
commit | e5437ef355c6956df7eeb47cf0612867392376a7 (patch) | |
tree | 8b75aa12233fe9f2d95579ea32dbd90c547aea3a /lib/internal/modules | |
parent | 168dd92537a1171b1a0b67c62ac91f60e8f409db (diff) | |
download | node-new-e5437ef355c6956df7eeb47cf0612867392376a7.tar.gz |
module: fix require in node repl
Fixes: https://github.com/nodejs/node/issues/30808
PR-URL: https://github.com/nodejs/node/pull/30835
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'lib/internal/modules')
-rw-r--r-- | lib/internal/modules/cjs/loader.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js index ffeaf2873e..c1142b819b 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js @@ -810,11 +810,11 @@ Module._resolveLookupPaths = function(request, parent) { return paths.length > 0 ? paths : null; } - // With --eval, parent.id is not set and parent.filename is null. + // In REPL, parent.filename is null. if (!parent || !parent.id || !parent.filename) { // Make require('./path/to/foo') work - normally the path is taken - // from realpath(__filename) but with eval there is no filename - const mainPaths = ['.'].concat(Module._nodeModulePaths('.'), modulePaths); + // from realpath(__filename) but in REPL there is no filename + const mainPaths = ['.']; debug('looking for %j in %j', request, mainPaths); return mainPaths; |