Skip to content
This repository was archived by the owner on Jan 26, 2019. It is now read-only.

Commit 993fd30

Browse files
gaearonwmonk
authored andcommitted
Consistently set environment variables (#2382)
1 parent 9114aea commit 993fd30

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

packages/react-scripts/scripts/build.js

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
'use strict';
1212

1313
// Do this as the first thing so that any code reading it knows the right env.
14+
process.env.BABEL_ENV = 'production';
1415
process.env.NODE_ENV = 'production';
1516

1617
// Makes the script crash on unhandled rejections instead of silently

packages/react-scripts/scripts/start.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,17 @@
1010
// @remove-on-eject-end
1111
'use strict';
1212

13+
// Do this as the first thing so that any code reading it knows the right env.
14+
process.env.BABEL_ENV = 'development';
15+
process.env.NODE_ENV = 'development';
16+
1317
// Makes the script crash on unhandled rejections instead of silently
1418
// ignoring them. In the future, promise rejections that are not handled will
1519
// terminate the Node.js process with a non-zero exit code.
1620
process.on('unhandledRejection', err => {
1721
throw err;
1822
});
1923

20-
process.env.NODE_ENV = 'development';
21-
2224
// Ensure environment variables are read.
2325
require('../config/env');
2426

packages/react-scripts/scripts/test.js

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
// @remove-on-eject-end
1111
'use strict';
1212

13+
// Do this as the first thing so that any code reading it knows the right env.
14+
process.env.BABEL_ENV = 'test';
1315
process.env.NODE_ENV = 'test';
1416
process.env.PUBLIC_URL = '';
1517

0 commit comments

Comments
 (0)