Skip to content

Commit

Permalink
fix: respect NODE_PATH env variable
Browse files Browse the repository at this point in the history
  • Loading branch information
snitin315 committed Sep 28, 2022
1 parent 9fcaa24 commit fde12c3
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions bin/webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,17 @@ const isInstalled = packageName => {
}
} while (dir !== (dir = path.dirname(dir)));

// https://github.com/nodejs/node/blob/v18.9.1/lib/internal/modules/cjs/loader.js#L1274
for (const internalPath of require("module").globalPaths) {
try {
if (fs.statSync(path.join(internalPath, packageName)).isDirectory()) {
return true;
}
} catch (_error) {
// Nothing
}
}

return false;
};

Expand Down

0 comments on commit fde12c3

Please sign in to comment.