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 Mar 11, 2023
1 parent 9fcaa24 commit 98375f6
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions bin/webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,19 @@ 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
// eslint-disable-next-line no-warning-comments
// @ts-ignore
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 98375f6

Please sign in to comment.