@@ -6,7 +6,6 @@ const WebSocket = require('ws');
66const _ = require ( 'lodash' ) ;
77const express = require ( 'express' ) ;
88const ejs = require ( 'ejs' ) ;
9- const mkdir = require ( 'mkdirp' ) ;
109const { bold} = require ( 'chalk' ) ;
1110
1211const Logger = require ( './Logger' ) ;
@@ -163,7 +162,7 @@ async function generateReport(bundleStats, opts) {
163162
164163 const reportFilepath = path . resolve ( bundleDir || process . cwd ( ) , reportFilename ) ;
165164
166- mkdir . sync ( path . dirname ( reportFilepath ) ) ;
165+ fs . mkdirSync ( path . dirname ( reportFilepath ) , { recursive : true } ) ;
167166 fs . writeFileSync ( reportFilepath , reportHtml ) ;
168167
169168 logger . info ( `${ bold ( 'Webpack Bundle Analyzer' ) } saved report to ${ bold ( reportFilepath ) } ` ) ;
@@ -187,8 +186,8 @@ async function generateJSONReport(bundleStats, opts) {
187186
188187 if ( ! chartData ) return ;
189188
190- mkdir . sync ( path . dirname ( reportFilename ) ) ;
191- fs . writeFileSync ( reportFilename , JSON . stringify ( chartData ) ) ;
189+ await fs . promises . mkdir ( path . dirname ( reportFilename ) , { recursive : true } ) ;
190+ await fs . promises . writeFile ( reportFilename , JSON . stringify ( chartData ) ) ;
192191
193192 logger . info ( `${ bold ( 'Webpack Bundle Analyzer' ) } saved JSON report to ${ bold ( reportFilename ) } ` ) ;
194193}
0 commit comments