@@ -17,28 +17,7 @@ const url = require('url');
1717// Make sure any symlinks in the project folder are resolved:
1818// https://github.com/facebookincubator/create-react-app/issues/637
1919const appDirectory = fs . realpathSync ( process . cwd ( ) ) ;
20- const resolveApp = ( relativePath ) => path . resolve ( appDirectory , relativePath ) ;
21-
22- // We support resolving modules according to `NODE_PATH`.
23- // This lets you use absolute paths in imports inside large monorepos:
24- // https://github.com/facebookincubator/create-react-app/issues/253.
25-
26- // It works similar to `NODE_PATH` in Node itself:
27- // https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders
28-
29- // We will export `nodePaths` as an array of absolute paths.
30- // It will then be used by Webpack configs.
31- // Jest doesn’t need this because it already handles `NODE_PATH` out of the box.
32-
33- // Note that unlike in Node, only *relative* paths from `NODE_PATH` are honored.
34- // Otherwise, we risk importing Node.js core modules into an app instead of Webpack shims.
35- // https://github.com/facebookincubator/create-react-app/issues/1023#issuecomment-265344421
36-
37- const nodePaths = ( process . env . NODE_PATH || '' )
38- . split ( process . platform === 'win32' ? ';' : ':' )
39- . filter ( Boolean )
40- . filter ( folder => ! path . isAbsolute ( folder ) )
41- . map ( resolveApp ) ;
20+ const resolveApp = relativePath => path . resolve ( appDirectory , relativePath ) ;
4221
4322const envPublicUrl = process . env . PUBLIC_URL ;
4423
@@ -53,7 +32,8 @@ function ensureSlash(path, needsSlash) {
5332 }
5433}
5534
56- const getPublicUrl = ( appPackageJson ) => envPublicUrl || require ( appPackageJson ) . homepage ;
35+ const getPublicUrl = appPackageJson =>
36+ envPublicUrl || require ( appPackageJson ) . homepage ;
5737
5838// We use `PUBLIC_URL` environment variable or "homepage" field to infer
5939// "public path" at which the app is served.
@@ -80,13 +60,12 @@ module.exports = {
8060 yarnLockFile : resolveApp ( 'yarn.lock' ) ,
8161 testsSetup : resolveApp ( 'src/setupTests.js' ) ,
8262 appNodeModules : resolveApp ( 'node_modules' ) ,
83- nodePaths : nodePaths ,
8463 publicUrl : getPublicUrl ( resolveApp ( 'package.json' ) ) ,
8564 servedPath : getServedPath ( resolveApp ( 'package.json' ) ) ,
8665} ;
8766
8867// @remove -on-eject-begin
89- const resolveOwn = ( relativePath ) => path . resolve ( __dirname , '..' , relativePath ) ;
68+ const resolveOwn = relativePath => path . resolve ( __dirname , '..' , relativePath ) ;
9069
9170// config before eject: we're in ./node_modules/react-scripts/config/
9271module . exports = {
@@ -101,7 +80,6 @@ module.exports = {
10180 yarnLockFile : resolveApp ( 'yarn.lock' ) ,
10281 testsSetup : resolveApp ( 'src/setupTests.js' ) ,
10382 appNodeModules : resolveApp ( 'node_modules' ) ,
104- nodePaths : nodePaths ,
10583 publicUrl : getPublicUrl ( resolveApp ( 'package.json' ) ) ,
10684 servedPath : getServedPath ( resolveApp ( 'package.json' ) ) ,
10785 // These properties only exist before ejecting:
131109 yarnLockFile : resolveOwn ( 'template/yarn.lock' ) ,
132110 testsSetup : resolveOwn ( 'template/src/setupTests.js' ) ,
133111 appNodeModules : resolveOwn ( 'node_modules' ) ,
134- nodePaths : nodePaths ,
135112 publicUrl : getPublicUrl ( resolveOwn ( 'package.json' ) ) ,
136113 servedPath : getServedPath ( resolveOwn ( 'package.json' ) ) ,
137114 // These properties only exist before ejecting:
0 commit comments