File tree Expand file tree Collapse file tree 6 files changed +20
-19
lines changed 
angular_devkit/build_angular/src Expand file tree Collapse file tree 6 files changed +20
-19
lines changed Original file line number Diff line number Diff line change 66 * found in the LICENSE file at https://angular.io/license 
77 */ 
88
9- import  {  Compilation ,   WebpackError  }  from  'webpack' ; 
9+ import  type   {  Compilation  }  from  'webpack' ; 
1010
1111export  function  addWarning ( compilation : Compilation ,  message : string ) : void { 
12-   compilation . warnings . push ( new  WebpackError ( message ) ) ; 
12+   compilation . warnings . push ( new  compilation . compiler . webpack . WebpackError ( message ) ) ; 
1313} 
1414
1515export  function  addError ( compilation : Compilation ,  message : string ) : void { 
16-   compilation . errors . push ( new  WebpackError ( message ) ) ; 
16+   compilation . errors . push ( new  compilation . compiler . webpack . WebpackError ( message ) ) ; 
1717} 
Original file line number Diff line number Diff line change 99import  *  as  fs  from  'fs' ; 
1010import  MiniCssExtractPlugin  from  'mini-css-extract-plugin' ; 
1111import  *  as  path  from  'path' ; 
12- import  {  Configuration ,  RuleSetUseItem ,   WebpackError  }  from  'webpack' ; 
12+ import  type   {  Configuration ,  RuleSetUseItem  }  from  'webpack' ; 
1313import  {  StyleElement  }  from  '../../builders/browser/schema' ; 
1414import  {  SassWorkerImplementation  }  from  '../../sass/sass-service' ; 
1515import  {  WebpackConfigOptions  }  from  '../../utils/build-options' ; 
16+ import  {  addWarning  }  from  '../../utils/webpack-diagnostics' ; 
1617import  { 
1718  AnyComponentStyleBudgetChecker , 
1819  PostcssCliResources , 
@@ -112,7 +113,7 @@ export function getStylesConfig(wco: WebpackConfigOptions): Configuration {
112113
113114      compiler . hooks . afterCompile . tap ( 'sass-worker' ,  ( compilation )  =>  { 
114115        for  ( const  message  of  sassTildeUsageMessage )  { 
115-           compilation . warnings . push ( new   WebpackError ( message ) ) ; 
116+           addWarning ( compilation ,   message ) ; 
116117        } 
117118
118119        sassTildeUsageMessage . clear ( ) ; 
Original file line number Diff line number Diff line change 77 */ 
88
99import  Piscina  from  'piscina' ; 
10- import  {  ScriptTarget  }  from  'typescript' ; 
1110import  type  {  Compiler ,  sources  }  from  'webpack' ; 
1211import  {  maxWorkers  }  from  '../../utils/environment-options' ; 
1312import  {  transformSupportedBrowsersToTargets  }  from  '../../utils/esbuild-targets' ; 
13+ import  {  addError  }  from  '../../utils/webpack-diagnostics' ; 
1414import  {  EsbuildExecutor  }  from  './esbuild-executor' ; 
1515import  type  {  OptimizeRequestOptions  }  from  './javascript-optimizer-worker' ; 
1616
@@ -220,10 +220,10 @@ export class JavaScriptOptimizerPlugin {
220220                      } ) ; 
221221                    } , 
222222                    ( error )  =>  { 
223-                       const  optimizationError  =  new  compiler . webpack . WebpackError ( 
223+                       addError ( 
224+                         compilation , 
224225                        `Optimization error [${ name } ${ error . stack  ||  error . message }  , 
225226                      ) ; 
226-                       compilation . errors . push ( optimizationError ) ; 
227227                    } , 
228228                  ) , 
229229              ) ; 
Original file line number Diff line number Diff line change 99import  {  promisify  }  from  'util' ; 
1010import  {  Compiler  }  from  'webpack' ; 
1111import  {  brotliCompress  }  from  'zlib' ; 
12+ import  {  addWarning  }  from  '../../utils/webpack-diagnostics' ; 
1213
1314const  brotliCompressAsync  =  promisify ( brotliCompress ) ; 
1415
@@ -49,10 +50,9 @@ export class TransferSizePlugin {
4950                  ) ; 
5051                } ) 
5152                . catch ( ( error )  =>  { 
52-                   compilation . warnings . push ( 
53-                     new  compilation . compiler . webpack . WebpackError ( 
54-                       `Unable to calculate estimated transfer size for '${ assetName } ${ error . message }  , 
55-                     ) , 
53+                   addWarning ( 
54+                     compilation , 
55+                     `Unable to calculate estimated transfer size for '${ assetName } ${ error . message }  , 
5656                  ) ; 
5757                } ) , 
5858            ) ; 
Original file line number Diff line number Diff line change @@ -189,12 +189,11 @@ export class AngularWebpackPlugin {
189189      try  { 
190190        this . setupCompilation ( compilation ,  compilationState ) ; 
191191      }  catch  ( error )  { 
192-         compilation . errors . push ( 
193-           new  WebpackError ( 
194-             `Failed to initialize Angular compilation - ${  
195-               error  instanceof  Error  ? error . message  : error  
196-             }  `, 
197-           ) , 
192+         addError ( 
193+           compilation , 
194+           `Failed to initialize Angular compilation - ${  
195+             error  instanceof  Error  ? error . message  : error  
196+           }  `, 
198197        ) ; 
199198      } 
200199    } ) ; 
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import assert from 'assert';
1010import  *  as  path  from  'path' ; 
1111import  *  as  vm  from  'vm' ; 
1212import  type  {  Asset ,  Compilation  }  from  'webpack' ; 
13+ import  {  addError  }  from  './ivy/diagnostics' ; 
1314import  {  normalizePath  }  from  './ivy/paths' ; 
1415import  { 
1516  CompilationWithInlineAngularResource , 
@@ -212,7 +213,7 @@ export class WebpackResourceLoader {
212213          }  catch  ( error )  { 
213214            assert ( error  instanceof  Error ,  'catch clause variable is not an Error instance' ) ; 
214215            // Use compilation errors, as otherwise webpack will choke 
215-             compilation . errors . push ( new   WebpackError ( error . message ) ) ; 
216+             addError ( compilation ,   error . message ) ; 
216217          } 
217218        } ) ; 
218219      } , 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments