Skip to content

Commit

Permalink
Only honor relative NODE_PATH (facebook#1194)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon authored and alexdriaguine committed Jan 23, 2017
1 parent 75a600e commit 16fe957
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 16fe957

Please sign in to comment.