From a5312e20ccb214569cf012f79a054bc8bbb91612 Mon Sep 17 00:00:00 2001 From: Moti Zilberman Date: Sat, 17 Sep 2016 00:13:38 +0300 Subject: [PATCH] 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 --- config/paths.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/config/paths.js b/config/paths.js index 9fbb4ecbc56..bb1ba761258 100644 --- a/config/paths.js +++ b/config/paths.js @@ -10,6 +10,14 @@ // @remove-on-eject-end 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`. // This lets you use absolute paths in imports inside large monorepos: @@ -25,11 +33,7 @@ var path = require('path'); var nodePaths = (process.env.NODE_PATH || '') .split(process.platform === 'win32' ? ';' : ':') .filter(Boolean) - .map(p => path.resolve(p)); - -function resolveApp(relativePath) { - return path.resolve(relativePath); -} + .map(resolveApp); // config after eject: we're in ./config/ module.exports = {