Skip to content
This repository has been archived by the owner on Apr 8, 2019. It is now read-only.

Commit

Permalink
chore: update internal Node.js function call
Browse files Browse the repository at this point in the history
This updates the call to `_resolveLookupPaths`. It returns a string
by default since Node.js v8 when called with a third truthy argument.
The backwards compatible return value should change soon, so detect
what return type is used and handle both cases.
  • Loading branch information
BridgeAR committed Apr 5, 2019
1 parent 1d28385 commit c8384dc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,10 @@ function packageNameFromPath(path) {
*/
function findModulePath(request, parent) {
var mainScriptDir = path.dirname(Module._resolveFilename(request, parent));
var resolvedModule = Module._resolveLookupPaths(request, parent);
var paths = resolvedModule[1];
var resolvedModule = Module._resolveLookupPaths(request, parent, true);
var paths = typeof resolvedModule === 'string' || resolvedModule === null ?
resolvedModule :
resolvedModule[1];
for (var i = 0, PL = paths.length; i < PL; i++) {
if (mainScriptDir.indexOf(paths[i]) === 0) {
return path.join(paths[i], request.replace('/', path.sep));
Expand Down

0 comments on commit c8384dc

Please sign in to comment.