Skip to content

Commit

Permalink
Only honor relative NODE_PATH (#1194)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon authored Dec 7, 2016
1 parent d68a989 commit cf64077
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/react-scripts/config/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,14 @@ function resolveApp(relativePath) {
// It will then be used by Webpack configs.
// Jest doesn’t need this because it already handles `NODE_PATH` out of the box.

// Note that unlike in Node, only *relative* paths from `NODE_PATH` are honored.
// Otherwise, we risk importing Node.js core modules into an app instead of Webpack shims.
// https://github.com/facebookincubator/create-react-app/issues/1023#issuecomment-265344421

var nodePaths = (process.env.NODE_PATH || '')
.split(process.platform === 'win32' ? ';' : ':')
.filter(Boolean)
.filter(folder => !path.isAbsolute(folder))
.map(resolveApp);

// config after eject: we're in ./config/
Expand Down

0 comments on commit cf64077

Please sign in to comment.