Skip to content

Commit

Permalink
Load app index file base on env REACT_APP
Browse files Browse the repository at this point in the history
  • Loading branch information
anvutp7 committed Aug 11, 2017
1 parent 93029f8 commit d5c5bbd
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/react-scripts/config/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,18 @@ function getServedPath(appPackageJson) {
return ensureSlash(servedUrl, true);
}

// Detect appIndexFile base on REACT_APP env
const appIndexFile = process.env.REACT_APP
? process.env.REACT_APP + 'Index'
: 'index';

// config after eject: we're in ./config/
module.exports = {
dotenv: resolveApp('.env'),
appBuild: resolveApp('build'),
appPublic: resolveApp('public'),
appHtml: resolveApp('public/index.html'),
appIndexJs: resolveApp('src/index.js'),
appIndexJs: resolveApp('src/' + appIndexFile + '.js'),
appPackageJson: resolveApp('package.json'),
appSrc: resolveApp('src'),
yarnLockFile: resolveApp('yarn.lock'),
Expand All @@ -74,7 +79,7 @@ module.exports = {
appBuild: resolveApp('build'),
appPublic: resolveApp('public'),
appHtml: resolveApp('public/index.html'),
appIndexJs: resolveApp('src/index.js'),
appIndexJs: resolveApp('src/' + appIndexFile + '.js'),
appPackageJson: resolveApp('package.json'),
appSrc: resolveApp('src'),
yarnLockFile: resolveApp('yarn.lock'),
Expand Down Expand Up @@ -104,7 +109,7 @@ if (
appBuild: resolveOwn('../../build'),
appPublic: resolveOwn('template/public'),
appHtml: resolveOwn('template/public/index.html'),
appIndexJs: resolveOwn('template/src/index.js'),
appIndexJs: resolveOwn('template/src/' + appIndexFile + '.js'),
appPackageJson: resolveOwn('package.json'),
appSrc: resolveOwn('template/src'),
yarnLockFile: resolveOwn('template/yarn.lock'),
Expand Down

0 comments on commit d5c5bbd

Please sign in to comment.