diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js index b101f23dbe13..428f5452c6d2 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js @@ -838,7 +838,7 @@ Module.runMain = function() { function createRequireFromPath(filename) { // Allow a directory to be passed as the filename const trailingSlash = - filename.endsWith(path.sep) || path.sep !== '/' && filename.endsWith('\\'); + filename.endsWith('/') || (isWindows && filename.endsWith('\\')); const proxyPath = trailingSlash ? path.join(filename, 'noop.js') :