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 bb6293a

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

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
@@ -1426,8 +1426,9 @@ Module._resolveFilename = function(request, parent, isMain, options) {
14261426
paths = Module._resolveLookupPaths(request, parent);
14271427
}
14281428

1429-
if (request[0] === '#' && (parent?.filename || parent?.id === '<repl>')) {
1430-
const parentPath = parent?.filename ?? process.cwd() + path.sep;
1429+
const parentPath = trySelfParentPath(parent);
1430+
1431+
if (request[0] === '#' && (parent.filename || parent.id === '<repl>')) {
14311432
const pkg = packageJsonReader.getNearestParentPackageJSON(parentPath);
14321433
if (pkg?.data.imports != null) {
14331434
try {
@@ -1447,7 +1448,6 @@ Module._resolveFilename = function(request, parent, isMain, options) {
14471448
}
14481449

14491450
// Try module self resolution first
1450-
const parentPath = trySelfParentPath(parent);
14511451
const selfResolved = trySelf(parentPath, request, conditions);
14521452
if (selfResolved) {
14531453
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.