@@ -1427,8 +1427,9 @@ Module._resolveFilename = function(request, parent, isMain, options) {
|
1427 | 1427 | paths = Module._resolveLookupPaths(request, parent); |
1428 | 1428 | } |
1429 | 1429 | |
1430 | | -if (request[0] === '#' && (parent?.filename || parent?.id === '<repl>')) { |
1431 | | -const parentPath = parent?.filename ?? process.cwd() + path.sep; |
| 1430 | +const parentPath = trySelfParentPath(parent); |
| 1431 | + |
| 1432 | +if (request[0] === '#' && (parent.filename || parent.id === '<repl>')) { |
1432 | 1433 | const pkg = packageJsonReader.getNearestParentPackageJSON(parentPath); |
1433 | 1434 | if (pkg?.data.imports != null) { |
1434 | 1435 | try { |
@@ -1448,7 +1449,6 @@ Module._resolveFilename = function(request, parent, isMain, options) {
|
1448 | 1449 | } |
1449 | 1450 | |
1450 | 1451 | // Try module self resolution first |
1451 | | -const parentPath = trySelfParentPath(parent); |
1452 | 1452 | const selfResolved = trySelf(parentPath, request, conditions); |
1453 | 1453 | if (selfResolved) { |
1454 | 1454 | const cacheKey = request + '\x00' + |
|