File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed
packages/react-scripts/config Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change 1515var REACT_APP = / ^ R E A C T _ A P P _ / i;
1616
1717function getClientEnvironment ( publicUrl ) {
18- return Object
18+ var processEnv = Object
1919 . keys ( process . env )
2020 . filter ( key => REACT_APP . test ( key ) )
2121 . reduce ( ( env , key ) => {
22- env [ 'process.env.' + key ] = JSON . stringify ( process . env [ key ] ) ;
22+ env [ key ] = JSON . stringify ( process . env [ key ] ) ;
2323 return env ;
2424 } , {
2525 // Useful for determining whether we’re running in production mode.
2626 // Most importantly, it switches React into the correct mode.
27- 'process.env. NODE_ENV' : JSON . stringify (
27+ 'NODE_ENV' : JSON . stringify (
2828 process . env . NODE_ENV || 'development'
2929 ) ,
3030 // Useful for resolving the correct path to static assets in `public`.
3131 // For example, <img src={process.env.PUBLIC_URL + '/img/logo.png'} />.
3232 // This should only be used as an escape hatch. Normally you would put
3333 // 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 )
3535 } ) ;
36+ return { 'process.env' : processEnv } ;
3637}
3738
3839module . exports = getClientEnvironment ;
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ var env = getClientEnvironment(publicUrl);
4949
5050// Assert this just to be safe.
5151// 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"' ) {
5353 throw new Error ( 'Production builds must have NODE_ENV=production.' ) ;
5454}
5555
You can’t perform that action at this time.
0 commit comments