Skip to content

Commit 9591168

Browse files
gaearonrandycoulman
authored andcommitted
Only honor relative NODE_PATH (facebook#1194)
1 parent c638594 commit 9591168

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/react-scripts/config/paths.js

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

36+
// Note that unlike in Node, only *relative* paths from `NODE_PATH` are honored.
37+
// Otherwise, we risk importing Node.js core modules into an app instead of Webpack shims.
38+
// https://github.com/facebookincubator/create-react-app/issues/1023#issuecomment-265344421
39+
3640
var nodePaths = (process.env.NODE_PATH || '')
3741
.split(process.platform === 'win32' ? ';' : ':')
3842
.filter(Boolean)
43+
.filter(folder => !path.isAbsolute(folder))
3944
.map(resolveApp);
4045

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

0 commit comments

Comments
 (0)