File tree Expand file tree Collapse file tree 1 file changed +16
-22
lines changed Expand file tree Collapse file tree 1 file changed +16
-22
lines changed Original file line number Diff line number Diff line change @@ -132,29 +132,23 @@ async function generateReport(bundleStats, opts) {
132132
133133  if  ( ! chartData )  return ; 
134134
135-   await  new  Promise ( ( resolve ,  reject )  =>  { 
136-     try  { 
137-       const  reportHtml  =  renderViewer ( { 
138-         mode : 'static' , 
139-         title : resolveTitle ( reportTitle ) , 
140-         chartData, 
141-         defaultSizes, 
142-         enableWebSocket : false 
143-       } ) ; 
144-       const  reportFilepath  =  path . resolve ( bundleDir  ||  process . cwd ( ) ,  reportFilename ) ; 
145- 
146-       fs . mkdirSync ( path . dirname ( reportFilepath ) ,  { recursive : true } ) ; 
147-       fs . writeFileSync ( reportFilepath ,  reportHtml ) ; 
148- 
149-       logger . info ( `${ bold ( 'Webpack Bundle Analyzer' ) }   saved report to ${ bold ( reportFilepath ) }  ` ) ; 
135+   const  reportHtml  =  renderViewer ( { 
136+     mode : 'static' , 
137+     title : resolveTitle ( reportTitle ) , 
138+     chartData, 
139+     defaultSizes, 
140+     enableWebSocket : false 
141+   } ) ; 
142+   const  reportFilepath  =  path . resolve ( bundleDir  ||  process . cwd ( ) ,  reportFilename ) ; 
150143
151-       if  ( openBrowser )  { 
152-         open ( `file://${ reportFilepath }  ` ,  logger ) ; 
153-       } 
154-       resolve ( ) ; 
155-     }  catch  ( e )  { 
156-       reject ( e ) ; 
157-     } 
144+   fs . mkdirSync ( path . dirname ( reportFilepath ) ,  { recursive : true } ) ; 
145+   fs . writeFileSync ( reportFilepath ,  reportHtml ) ; 
146+ 
147+   logger . info ( `${ bold ( 'Webpack Bundle Analyzer' ) }   saved report to ${ bold ( reportFilepath ) }  ` ) ; 
148+ 
149+   if  ( openBrowser )  { 
150+     open ( `file://${ reportFilepath }  ` ,  logger ) ; 
151+   } 
158152  } ) ; 
159153} 
160154
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments