@@ -24,6 +24,7 @@ Stats.prototype.toJson = function toJson(options, forToString) {
2424 var compilation = this . compilation ;
2525 var requestShortener = new RequestShortener ( d ( options . context , process . cwd ( ) ) ) ;
2626 var showHash = d ( options . hash , true ) ;
27+ var showVersion = d ( options . version , true ) ;
2728 var showTimings = d ( options . timings , true ) ;
2829 var showAssets = d ( options . assets , true ) ;
2930 var showChunks = d ( options . chunks , true ) ;
@@ -68,18 +69,21 @@ Stats.prototype.toJson = function toJson(options, forToString) {
6869 if ( ! dep . loc ) return ;
6970 if ( ! dep . loc . start ) return ;
7071 if ( ! dep . loc . end ) return ;
71- text += " " + dep . loc . start . line + ":" + dep . loc . start . column + "-" +
72+ text += " " + dep . loc . start . line + ":" + dep . loc . start . column + "-" +
7273 ( dep . loc . start . line !== dep . loc . end . line ? dep . loc . end . line + ":" : "" ) + dep . loc . end . column ;
7374 } ) ;
7475 }
7576 return text ;
7677 }
7778 var obj = {
78- version : require ( "../package.json" ) . version ,
7979 errors : compilation . errors . map ( formatError ) ,
8080 warnings : compilation . warnings . map ( formatError )
8181 } ;
8282
83+ if ( showVersion ) {
84+ obj . version = require ( "../package.json" ) . version ;
85+ }
86+
8387 if ( showHash ) obj . hash = this . hash ;
8488 if ( showTimings && this . startTime && this . endTime ) {
8589 obj . time = this . endTime - this . startTime ;
0 commit comments