Consistently set environment variables (#2382)

This commit is contained in:
Dan Abramov
2017-05-27 12:37:07 +01:00
committed by William Monk
parent 9114aea7ac
commit 993fd306c5
3 changed files with 7 additions and 2 deletions

View File

@@ -11,6 +11,7 @@
'use strict';
// Do this as the first thing so that any code reading it knows the right env.
process.env.BABEL_ENV = 'production';
process.env.NODE_ENV = 'production';
// Makes the script crash on unhandled rejections instead of silently

View File

@@ -10,6 +10,10 @@
// @remove-on-eject-end
'use strict';
// Do this as the first thing so that any code reading it knows the right env.
process.env.BABEL_ENV = 'development';
process.env.NODE_ENV = 'development';
// Makes the script crash on unhandled rejections instead of silently
// ignoring them. In the future, promise rejections that are not handled will
// terminate the Node.js process with a non-zero exit code.
@@ -17,8 +21,6 @@ process.on('unhandledRejection', err => {
throw err;
});
process.env.NODE_ENV = 'development';
// Ensure environment variables are read.
require('../config/env');

View File

@@ -10,6 +10,8 @@
// @remove-on-eject-end
'use strict';
// Do this as the first thing so that any code reading it knows the right env.
process.env.BABEL_ENV = 'test';
process.env.NODE_ENV = 'test';
process.env.PUBLIC_URL = '';