File tree 1 file changed +16
-2
lines changed
packages/react-scripts/scripts
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) {
118
118
} ) ;
119
119
}
120
120
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
+
121
131
// Create the production build and print the deployment instructions.
122
132
function build ( previousSizeMap ) {
123
133
console . log ( 'Creating an optimized production build...' ) ;
124
134
webpack ( config ) . run ( ( err , stats ) => {
125
135
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 ) ;
128
142
process . exit ( 1 ) ;
129
143
}
130
144
You can’t perform that action at this time.
0 commit comments