While looking at #15015 (comment) I noticed that the trailing slash check in _findPath was only keying off of a forward slash and not the backslash that Windows allows.
You can repro this by simply doing the following in a directory with an index.js
require(".\\")// throwsrequire("./")// will find the index.jsOther places in Node account for the backslash in Windows paths so this looks like an oversight.
Update:
It looks like if it's a two dot relative path to an index.js then it does work.
require("..\\")// workrequire("..\\.")// worksrequire("../")// worksrequire("../.")// worksAlso this
require("./..")// worksrequire(".\\..")// throwsNotes:
It looks like path.resolve handles these cases fine so it can be excluded from the problem.
path.resolve(".\\")// 'C:\\projects\\bar\\foo'path.resolve(".\\..")// 'C:\\projects\\bar'
While looking at #15015 (comment) I noticed that the trailing slash check in
_findPathwas only keying off of a forward slash and not the backslash that Windows allows.You can repro this by simply doing the following in a directory with an
index.jsOther places in Node account for the backslash in Windows paths so this looks like an oversight.
Update:
It looks like if it's a two dot relative path to an index.js then it does work.
Also this
Notes:
It looks like
path.resolvehandles these cases fine so it can be excluded from the problem.