@@ -13,10 +13,6 @@ var path = require('path');
13
13
var fs = require ( 'fs' ) ;
14
14
var url = require ( 'url' ) ;
15
15
16
- // @remove -on-eject-begin
17
- var isReactScriptsLinked = require ( '../utils/isReactScriptsLinked' ) ;
18
- // @remove -on-eject-end
19
-
20
16
// Make sure any symlinks in the project folder are resolved:
21
17
// https://github.com/facebookincubator/create-react-app/issues/637
22
18
var appDirectory = fs . realpathSync ( process . cwd ( ) ) ;
@@ -95,11 +91,13 @@ module.exports = {
95
91
96
92
// @remove -on-eject-begin
97
93
function resolveOwn ( relativePath ) {
98
- return path . resolve ( __dirname , relativePath ) ;
94
+ return path . resolve ( __dirname , '..' , relativePath ) ;
99
95
}
100
96
101
97
// config before eject: we're in ./node_modules/react-scripts/config/
102
98
module . exports = {
99
+ appPath : resolveApp ( '.' ) ,
100
+ ownPath : resolveOwn ( '.' ) ,
103
101
appBuild : resolveApp ( 'build' ) ,
104
102
appPublic : resolveApp ( 'public' ) ,
105
103
appHtml : resolveApp ( 'public/index.html' ) ,
@@ -110,28 +108,34 @@ module.exports = {
110
108
testsSetup : resolveApp ( 'src/setupTests.js' ) ,
111
109
appNodeModules : resolveApp ( 'node_modules' ) ,
112
110
// this is empty with npm3 but node resolution searches higher anyway:
113
- ownNodeModules : resolveOwn ( '../ node_modules' ) ,
111
+ ownNodeModules : resolveOwn ( 'node_modules' ) ,
114
112
nodePaths : nodePaths ,
115
113
publicUrl : getPublicUrl ( resolveApp ( 'package.json' ) ) ,
116
114
servedPath : getServedPath ( resolveApp ( 'package.json' ) )
117
115
} ;
118
116
117
+
118
+ var reactScriptsPath = path . resolve ( 'node_modules/react-scripts' ) ;
119
+ var reactScriptsLinked = fs . existsSync ( reactScriptsPath ) && fs . lstatSync ( reactScriptsPath ) . isSymbolicLink ( ) ;
120
+
119
121
// config before publish: we're in ./packages/react-scripts/config/
120
- if ( ! isReactScriptsLinked ( ) && __dirname . indexOf ( path . join ( 'packages' , 'react-scripts' , 'config' ) ) !== - 1 ) {
122
+ if ( ! reactScriptsLinked && __dirname . indexOf ( path . join ( 'packages' , 'react-scripts' , 'config' ) ) !== - 1 ) {
121
123
module . exports = {
122
- appBuild : resolveOwn ( '../../../build' ) ,
123
- appPublic : resolveOwn ( '../template/public' ) ,
124
- appHtml : resolveOwn ( '../template/public/index.html' ) ,
125
- appIndexJs : resolveOwn ( '../template/src/index.js' ) ,
126
- appPackageJson : resolveOwn ( '../package.json' ) ,
127
- appSrc : resolveOwn ( '../template/src' ) ,
128
- yarnLockFile : resolveOwn ( '../template/yarn.lock' ) ,
129
- testsSetup : resolveOwn ( '../template/src/setupTests.js' ) ,
130
- appNodeModules : resolveOwn ( '../node_modules' ) ,
131
- ownNodeModules : resolveOwn ( '../node_modules' ) ,
124
+ appPath : resolveApp ( '.' ) ,
125
+ ownPath : resolveOwn ( '.' ) ,
126
+ appBuild : resolveOwn ( '../../build' ) ,
127
+ appPublic : resolveOwn ( 'template/public' ) ,
128
+ appHtml : resolveOwn ( 'template/public/index.html' ) ,
129
+ appIndexJs : resolveOwn ( 'template/src/index.js' ) ,
130
+ appPackageJson : resolveOwn ( 'package.json' ) ,
131
+ appSrc : resolveOwn ( 'template/src' ) ,
132
+ yarnLockFile : resolveOwn ( 'template/yarn.lock' ) ,
133
+ testsSetup : resolveOwn ( 'template/src/setupTests.js' ) ,
134
+ appNodeModules : resolveOwn ( 'node_modules' ) ,
135
+ ownNodeModules : resolveOwn ( 'node_modules' ) ,
132
136
nodePaths : nodePaths ,
133
- publicUrl : getPublicUrl ( resolveOwn ( '../ package.json' ) ) ,
134
- servedPath : getServedPath ( resolveOwn ( '../ package.json' ) )
137
+ publicUrl : getPublicUrl ( resolveOwn ( 'package.json' ) ) ,
138
+ servedPath : getServedPath ( resolveOwn ( 'package.json' ) )
135
139
} ;
136
140
}
137
141
// @remove -on-eject-end
0 commit comments