From c0238dacf24fa67754f17e73194bf6d502889a4d Mon Sep 17 00:00:00 2001 From: Pieter Ouwerkerk Date: Wed, 8 Mar 2023 14:24:23 -0500 Subject: [PATCH] module: fix resolution consistency between '.' and './' Fixes: https://github.com/nodejs/node/issues/47000 --- lib/internal/modules/cjs/loader.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js index 0727c8d2cffad3..ec44e821876a81 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js @@ -1027,7 +1027,8 @@ Module._resolveFilename = function(request, parent, isMain, options) { const isRelative = StringPrototypeStartsWith(request, './') || StringPrototypeStartsWith(request, '../') || ((isWindows && StringPrototypeStartsWith(request, '.\\')) || - StringPrototypeStartsWith(request, '..\\')); + StringPrototypeStartsWith(request, '..\\')) || + request === '..' || request === '.'; if (isRelative) { paths = options.paths;