@@ -161,46 +161,50 @@ class FederationDashboardPlugin {
161161 chunkDependencies,
162162 } ;
163163
164- const graphData = convertToGraph ( rawData ) ;
165-
166- const dashData = ( this . _dashData = JSON . stringify ( graphData ) ) ;
167-
168- if ( this . _options . filename ) {
169- const hashPath = path . join ( stats . outputPath , this . _options . filename ) ;
170- fs . writeFile ( hashPath , dashData , { encoding : "utf-8" } , ( ) => { } ) ;
164+ let graphData = null ;
165+ try {
166+ graphData = convertToGraph ( rawData ) ;
167+ } catch ( err ) {
168+ console . warn ( "Error during dashboard data processing" ) ;
169+ console . warn ( err ) ;
171170 }
172171
173- const statsPath = path . join ( stats . outputPath , "stats.json" ) ;
174- fs . writeFile (
175- statsPath ,
176- JSON . stringify ( stats ) ,
177- { encoding : "utf-8" } ,
178- ( ) => { }
179- ) ;
172+ if ( graphData ) {
173+ const dashData = ( this . _dashData = JSON . stringify ( graphData ) ) ;
180174
181- if ( this . _options . dashboardURL ) {
182- new Promise ( ( resolve ) => {
183- fetch ( this . _options . dashboardURL , {
184- method : "POST" ,
185- body : dashData ,
186- headers : {
187- Accept : "application/json" ,
188- "Content-type" : "application/json" ,
189- } ,
190- } )
191- . then ( ( resp ) => resp . json ( ) )
192- . then ( resolve )
193- . catch ( ( ) => {
194- console . warn (
195- `Error posting data to dashboard URL: ${ this . _options . dashboardURL } `
196- ) ;
197- resolve ( ) ;
198- } ) ;
199- } ) ;
200- }
175+ if ( this . _options . filename ) {
176+ const hashPath = path . join ( stats . outputPath , this . _options . filename ) ;
177+ fs . writeFile ( hashPath , dashData , { encoding : "utf-8" } , ( ) => { } ) ;
178+ }
201179
202- if ( this . _options . reportFunction ) {
203- // this._options.reportFunction(this._dashData);
180+ const statsPath = path . join ( stats . outputPath , "stats.json" ) ;
181+ fs . writeFile (
182+ statsPath ,
183+ JSON . stringify ( stats ) ,
184+ { encoding : "utf-8" } ,
185+ ( ) => { }
186+ ) ;
187+
188+ if ( this . _options . dashboardURL ) {
189+ new Promise ( ( resolve ) => {
190+ fetch ( this . _options . dashboardURL , {
191+ method : "POST" ,
192+ body : dashData ,
193+ headers : {
194+ Accept : "application/json" ,
195+ "Content-type" : "application/json" ,
196+ } ,
197+ } )
198+ . then ( ( resp ) => resp . json ( ) )
199+ . then ( resolve )
200+ . catch ( ( ) => {
201+ console . warn (
202+ `Error posting data to dashboard URL: ${ this . _options . dashboardURL } `
203+ ) ;
204+ resolve ( ) ;
205+ } ) ;
206+ } ) ;
207+ }
204208 }
205209 } ) ;
206210 }
0 commit comments