File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed 
packages/react-scripts/scripts Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -118,13 +118,27 @@ function printFileSizes(stats, previousSizeMap) {
118118  } ) ; 
119119} 
120120
121+ // Print out errors 
122+ function  printErrors ( summary ,  errors )  { 
123+   console . log ( chalk . red ( summary ) ) ; 
124+   console . log ( ) ; 
125+   errors . forEach ( err  =>  { 
126+     console . log ( err . message  ||  err ) ; 
127+     console . log ( ) ; 
128+   } ) ; 
129+ } 
130+ 
121131// Create the production build and print the deployment instructions. 
122132function  build ( previousSizeMap )  { 
123133  console . log ( 'Creating an optimized production build...' ) ; 
124134  webpack ( config ) . run ( ( err ,  stats )  =>  { 
125135    if  ( err )  { 
126-       console . error ( 'Failed to create a production build. Reason:' ) ; 
127-       console . error ( err . message  ||  err ) ; 
136+       printErrors ( 'Failed to compile.' ,  [ err ] ) ; 
137+       process . exit ( 1 ) ; 
138+     } 
139+ 
140+     if  ( stats . compilation . errors . length )  { 
141+       printErrors ( 'Failed to compile.' ,  stats . compilation . errors ) ; 
128142      process . exit ( 1 ) ; 
129143    } 
130144
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments