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 19, 2022
1 parent 8581a4b commit bc19031
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/webpack-cli/src/webpack-cli.ts
Expand Up @@ -148,7 +148,10 @@ class WebpackCLI implements IWebpackCLI {

do {
try {
if (fs.statSync(path.join(dir, "node_modules", packageName)).isDirectory()) {
const packagePath = process.env.NODE_PATH
? path.join(process.env.NODE_PATH, packageName)
: path.join(dir, "node_modules", packageName);
if (fs.statSync(packagePath).isDirectory()) {
return true;
}
} catch (_error) {
Expand Down

0 comments on commit bc19031

Please sign in to comment.