Skip to content

Commit

Permalink
fix: respect NODE_PATH env variable (#3411)
Browse files Browse the repository at this point in the history
  • Loading branch information
snitin315 committed Nov 6, 2022
1 parent dcbd6f7 commit ff141b1
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/webpack-cli/src/webpack-cli.ts
Expand Up @@ -156,6 +156,17 @@ class WebpackCLI implements IWebpackCLI {
}
} 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 ff141b1

Please sign in to comment.