Commit 07105bfd authored by Moti Zilberman's avatar Moti Zilberman Committed by Dan Abramov
Browse files

Resolve app paths from realpath of CWD, fix #637 (#648)

* Resolve app paths from realpath of CWD, fix #637

* Use new resolveApp() for NODE_PATH too
parent e71378f4
Showing with 9 additions and 5 deletions
+9 -5
...@@ -10,6 +10,14 @@ ...@@ -10,6 +10,14 @@
// @remove-on-eject-end // @remove-on-eject-end
var path = require('path'); var path = require('path');
var fs = require('fs');
// Make sure any symlinks in the project folder are resolved:
// https://github.com/facebookincubator/create-react-app/issues/637
var appDirectory = fs.realpathSync(process.cwd());
function resolveApp(relativePath) {
return path.resolve(appDirectory, relativePath);
}
// We support resolving modules according to `NODE_PATH`. // We support resolving modules according to `NODE_PATH`.
// This lets you use absolute paths in imports inside large monorepos: // This lets you use absolute paths in imports inside large monorepos:
...@@ -25,11 +33,7 @@ var path = require('path'); ...@@ -25,11 +33,7 @@ var path = require('path');
var nodePaths = (process.env.NODE_PATH || '') var nodePaths = (process.env.NODE_PATH || '')
.split(process.platform === 'win32' ? ';' : ':') .split(process.platform === 'win32' ? ';' : ':')
.filter(Boolean) .filter(Boolean)
.map(p => path.resolve(p)); .map(resolveApp);
function resolveApp(relativePath) {
return path.resolve(relativePath);
}
// config after eject: we're in ./config/ // config after eject: we're in ./config/
module.exports = { module.exports = {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment