File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -144,18 +144,6 @@ class WebpackCLI implements IWebpackCLI {
144144 return true ;
145145 }
146146
147- // Respect NODE_PATH environment variable
148- try {
149- if (
150- process . env . NODE_PATH &&
151- fs . statSync ( path . join ( process . env . NODE_PATH , packageName ) ) . isDirectory ( )
152- ) {
153- return true ;
154- }
155- } catch ( _error ) {
156- // Nothing
157- }
158-
159147 let dir = __dirname ;
160148
161149 do {
@@ -168,6 +156,17 @@ class WebpackCLI implements IWebpackCLI {
168156 }
169157 } while ( dir !== ( dir = path . dirname ( dir ) ) ) ;
170158
159+ // https://github.com/nodejs/node/blob/v18.9.1/lib/internal/modules/cjs/loader.js#L1274
160+ for ( const internalPath of require ( "module" ) . globalPaths ) {
161+ try {
162+ if ( fs . statSync ( path . join ( internalPath , packageName ) ) . isDirectory ( ) ) {
163+ return true ;
164+ }
165+ } catch ( _error ) {
166+ // Nothing
167+ }
168+ }
169+
171170 return false ;
172171 }
173172
You can’t perform that action at this time.
0 commit comments