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 authored and alexander-akait committed Nov 15, 2022
1 parent 7c9ece2 commit 83d1f58
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/webpack-cli/src/webpack-cli.ts
Original file line number Diff line number Diff line change
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 83d1f58

Please sign in to comment.