Skip to content

Commit a5312e2

Browse files
motiz88feiqitian
authored andcommitted
Resolve app paths from realpath of CWD, fix facebook#637 (facebook#648)
* Resolve app paths from realpath of CWD, fix facebook#637 * Use new resolveApp() for NODE_PATH too
1 parent 6182bb1 commit a5312e2

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

config/paths.js

+9-5
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@
1010
// @remove-on-eject-end
1111

1212
var path = require('path');
13+
var fs = require('fs');
14+
15+
// Make sure any symlinks in the project folder are resolved:
16+
// https://github.com/facebookincubator/create-react-app/issues/637
17+
var appDirectory = fs.realpathSync(process.cwd());
18+
function resolveApp(relativePath) {
19+
return path.resolve(appDirectory, relativePath);
20+
}
1321

1422
// We support resolving modules according to `NODE_PATH`.
1523
// This lets you use absolute paths in imports inside large monorepos:
@@ -25,11 +33,7 @@ var path = require('path');
2533
var nodePaths = (process.env.NODE_PATH || '')
2634
.split(process.platform === 'win32' ? ';' : ':')
2735
.filter(Boolean)
28-
.map(p => path.resolve(p));
29-
30-
function resolveApp(relativePath) {
31-
return path.resolve(relativePath);
32-
}
36+
.map(resolveApp);
3337

3438
// config after eject: we're in ./config/
3539
module.exports = {

0 commit comments

Comments
 (0)