Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 13b7d08

Browse filesBrowse files
committed
module: remove duplicated checks from _resolveFilename
PR-URL: #62729 Reviewed-By: Jacob Smith <jacob@frende.me>
1 parent 00e86f0 commit 13b7d08
Copy full SHA for 13b7d08

1 file changed

+3-3Lines changed: 3 additions & 3 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/internal/modules/cjs/loader.js‎

Copy file name to clipboardExpand all lines: lib/internal/modules/cjs/loader.js
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,8 +1427,9 @@ Module._resolveFilename = function(request, parent, isMain, options) {
14271427
paths = Module._resolveLookupPaths(request, parent);
14281428
}
14291429

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>')) {
14321433
const pkg = packageJsonReader.getNearestParentPackageJSON(parentPath);
14331434
if (pkg?.data.imports != null) {
14341435
try {
@@ -1448,7 +1449,6 @@ Module._resolveFilename = function(request, parent, isMain, options) {
14481449
}
14491450

14501451
// Try module self resolution first
1451-
const parentPath = trySelfParentPath(parent);
14521452
const selfResolved = trySelf(parentPath, request, conditions);
14531453
if (selfResolved) {
14541454
const cacheKey = request + '\x00' +

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.