File tree 2 files changed +6
-5
lines changed
packages/react-scripts/config
2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change 15
15
var REACT_APP = / ^ R E A C T _ A P P _ / i;
16
16
17
17
function getClientEnvironment ( publicUrl ) {
18
- return Object
18
+ var processEnv = Object
19
19
. keys ( process . env )
20
20
. filter ( key => REACT_APP . test ( key ) )
21
21
. reduce ( ( env , key ) => {
22
- env [ 'process.env.' + key ] = JSON . stringify ( process . env [ key ] ) ;
22
+ env [ key ] = JSON . stringify ( process . env [ key ] ) ;
23
23
return env ;
24
24
} , {
25
25
// Useful for determining whether we’re running in production mode.
26
26
// Most importantly, it switches React into the correct mode.
27
- 'process.env. NODE_ENV' : JSON . stringify (
27
+ 'NODE_ENV' : JSON . stringify (
28
28
process . env . NODE_ENV || 'development'
29
29
) ,
30
30
// Useful for resolving the correct path to static assets in `public`.
31
31
// For example, <img src={process.env.PUBLIC_URL + '/img/logo.png'} />.
32
32
// This should only be used as an escape hatch. Normally you would put
33
33
// images into the `src` and `import` them in code to get their paths.
34
- 'process.env. PUBLIC_URL' : JSON . stringify ( publicUrl )
34
+ 'PUBLIC_URL' : JSON . stringify ( publicUrl )
35
35
} ) ;
36
+ return { 'process.env' : processEnv } ;
36
37
}
37
38
38
39
module . exports = getClientEnvironment ;
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ var env = getClientEnvironment(publicUrl);
49
49
50
50
// Assert this just to be safe.
51
51
// Development builds of React are slow and not intended for production.
52
- if ( env [ 'process.env.NODE_ENV' ] !== '"production"' ) {
52
+ if ( env [ 'process.env' ] . NODE_ENV !== '"production"' ) {
53
53
throw new Error ( 'Production builds must have NODE_ENV=production.' ) ;
54
54
}
55
55
You can’t perform that action at this time.
0 commit comments