File tree Expand file tree Collapse file tree 3 files changed +34
-10
lines changed Expand file tree Collapse file tree 3 files changed +34
-10
lines changed Original file line number Diff line number Diff line change 31
31
"dependencies" : {
32
32
"@webpack-bundle-analyzer/reporter-treemap" : " ^3.0.0-alpha.1" ,
33
33
"acorn" : " ^5.1.1" ,
34
+ "bfj-node4" : " ^4.2.4" ,
34
35
"chalk" : " ^1.1.3" ,
35
36
"commander" : " ^2.9.0" ,
36
37
"ejs" : " ^2.5.6" ,
Original file line number Diff line number Diff line change 1
- const fs = require ( 'fs ' ) ;
1
+ const bfj = require ( 'bfj-node4 ' ) ;
2
2
const path = require ( 'path' ) ;
3
3
const mkdir = require ( 'mkdirp' ) ;
4
4
const { bold } = require ( 'chalk' ) ;
@@ -69,19 +69,27 @@ class BundleAnalyzerPlugin {
69
69
} ) ;
70
70
}
71
71
72
- generateStatsFile ( stats ) {
72
+ async generateStatsFile ( stats ) {
73
73
const statsFilepath = path . resolve ( this . compiler . outputPath , this . opts . statsFilename ) ;
74
-
75
74
mkdir . sync ( path . dirname ( statsFilepath ) ) ;
76
75
77
- fs . writeFileSync (
78
- statsFilepath ,
79
- JSON . stringify ( stats , null , 2 )
80
- ) ;
76
+ try {
77
+ await bfj . write ( statsFilepath , stats , {
78
+ promises : 'ignore' ,
79
+ buffers : 'ignore' ,
80
+ maps : 'ignore' ,
81
+ iterables : 'ignore' ,
82
+ circular : 'ignore'
83
+ } ) ;
81
84
82
- this . logger . info (
83
- `${ bold ( 'Webpack Bundle Analyzer' ) } saved stats file to ${ bold ( statsFilepath ) } `
84
- ) ;
85
+ this . logger . info (
86
+ `${ bold ( 'Webpack Bundle Analyzer' ) } saved stats file to ${ bold ( statsFilepath ) } `
87
+ ) ;
88
+ } catch ( error ) {
89
+ this . logger . error (
90
+ `${ bold ( 'Webpack Bundle Analyzer' ) } error saving stats file to ${ bold ( statsFilepath ) } : ${ error } `
91
+ ) ;
92
+ }
85
93
}
86
94
87
95
async startAnalyzerServer ( stats ) {
Original file line number Diff line number Diff line change @@ -841,6 +841,13 @@ beeper@^1.0.0:
841
841
version "1.1.1"
842
842
resolved "https://registry.yarnpkg.com/beeper/-/beeper-1.1.1.tgz#e6d5ea8c5dad001304a70b22638447f69cb2f809"
843
843
844
+ bfj-node4@^4.2.4 :
845
+ version "4.2.4"
846
+ resolved "https://registry.yarnpkg.com/bfj-node4/-/bfj-node4-4.2.4.tgz#8484fe2ec73ea195906f3fd26ebd309be233e91a"
847
+ dependencies :
848
+ check-types "^7.3.0"
849
+ tryer "^1.0.0"
850
+
844
851
big.js@^3.1.3 :
845
852
version "3.2.0"
846
853
resolved "https://registry.yarnpkg.com/big.js/-/big.js-3.2.0.tgz#a5fc298b81b9e0dca2e458824784b65c52ba588e"
@@ -1074,6 +1081,10 @@ chalk@^2.0.0, chalk@^2.1.0:
1074
1081
escape-string-regexp "^1.0.5"
1075
1082
supports-color "^4.0.0"
1076
1083
1084
+ check-types@^7.3.0 :
1085
+ version "7.3.0"
1086
+ resolved "https://registry.yarnpkg.com/check-types/-/check-types-7.3.0.tgz#468f571a4435c24248f5fd0cb0e8d87c3c341e7d"
1087
+
1077
1088
chokidar@^1.6.0, chokidar@^1.6.1, chokidar@^1.7.0 :
1078
1089
version "1.7.0"
1079
1090
resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-1.7.0.tgz#798e689778151c8076b4b360e5edd28cda2bb468"
@@ -5891,6 +5902,10 @@ trim-right@^1.0.1:
5891
5902
version "1.0.1"
5892
5903
resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003"
5893
5904
5905
+ tryer@^1.0.0 :
5906
+ version "1.0.0"
5907
+ resolved "https://registry.yarnpkg.com/tryer/-/tryer-1.0.0.tgz#027b69fa823225e551cace3ef03b11f6ab37c1d7"
5908
+
5894
5909
tryit@^1.0.1 :
5895
5910
version "1.0.3"
5896
5911
resolved "https://registry.yarnpkg.com/tryit/-/tryit-1.0.3.tgz#393be730a9446fd1ead6da59a014308f36c289cb"
You can’t perform that action at this time.
0 commit comments