Skip to content

Commit cf64077

Browse files
authored
Only honor relative NODE_PATH (#1194)
1 parent d68a989 commit cf64077

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Diff for: packages/react-scripts/config/paths.js

+5
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,14 @@ function resolveApp(relativePath) {
3030
// It will then be used by Webpack configs.
3131
// Jest doesn’t need this because it already handles `NODE_PATH` out of the box.
3232

33+
// Note that unlike in Node, only *relative* paths from `NODE_PATH` are honored.
34+
// Otherwise, we risk importing Node.js core modules into an app instead of Webpack shims.
35+
// https://github.com/facebookincubator/create-react-app/issues/1023#issuecomment-265344421
36+
3337
var nodePaths = (process.env.NODE_PATH || '')
3438
.split(process.platform === 'win32' ? ';' : ':')
3539
.filter(Boolean)
40+
.filter(folder => !path.isAbsolute(folder))
3641
.map(resolveApp);
3742

3843
// config after eject: we're in ./config/

0 commit comments

Comments
 (0)