Skip to content

Commit

Permalink
fixup: remove unnecessary string manipulation
Browse files Browse the repository at this point in the history
  • Loading branch information
JakobJingleheimer committed Oct 1, 2024
1 parent 903d201 commit b567e9a
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions lib/internal/modules/cjs/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ const {
StringPrototypeEndsWith,
StringPrototypeIndexOf,
StringPrototypeRepeat,
StringPrototypeReplace,
StringPrototypeSlice,
StringPrototypeSplit,
StringPrototypeStartsWith,
Expand Down Expand Up @@ -1220,9 +1219,9 @@ Module._resolveFilename = function(request, parent, isMain, options) {
try {
const { packageImportsResolve } = require('internal/modules/esm/resolve');
return finalizeEsmResolution(
packageImportsResolve(request, pathToFileURL(parentPath),
getCjsConditions()), parentPath,
StringPrototypeReplace(pkg.path, '/package.json', ''),
packageImportsResolve(request, pathToFileURL(parentPath), getCjsConditions()),
parentPath,
pkg.path,
);
} catch (e) {
if (e.code === 'ERR_MODULE_NOT_FOUND') {
Expand Down Expand Up @@ -1283,8 +1282,7 @@ function finalizeEsmResolution(resolved, parentPath, pkgPath) {
if (actual) {
return actual;
}
const err = createEsmNotFoundErr(filename,
path.resolve(pkgPath, 'package.json'));
const err = createEsmNotFoundErr(filename, pkgPath);
throw err;
}

Expand Down

0 comments on commit b567e9a

Please sign in to comment.