react-universally icon indicating copy to clipboard operation
react-universally copied to clipboard

.env registered, even with a more specific option available

Open mschipperheyn opened this issue 8 years ago • 0 comments

React Universally will use the .env file even if there is for example an .env.test file available

config/utils/envVars.js

const envFileResolutionOrder = removeNil([
    // Is there an environment config file at the app root?
    // This always takes preference.
    // e.g. /projects/react-universally/.env
    path.resolve(appRootDir.get(), envFile),
    // Is there an environment config file at the app root for our target
    // environment name?
    // e.g. /projects/react-universally/.env.staging
    ifElse(DEPLOYMENT)(path.resolve(appRootDir.get(), `${envFile}.${DEPLOYMENT}`)),
  ]);

should be

const envFileResolutionOrder = removeNil([
    // Is there an environment config file at the app root for our target
    // environment name?
    // e.g. /projects/react-universally/.env.staging
    ifElse(DEPLOYMENT)(path.resolve(appRootDir.get(), `${envFile}.${DEPLOYMENT}`)),
    // Is there an environment config file at the app root?
    // This always takes preference.
    // e.g. /projects/react-universally/.env
    path.resolve(appRootDir.get(), envFile),
  ]);

mschipperheyn avatar Sep 18 '17 16:09 mschipperheyn