fixes stats as json
This commit is contained in:
parent
c88bce3b08
commit
30c4174915
|
@ -53,8 +53,6 @@ function ifArg(name, fn, init) {
|
|||
|
||||
|
||||
var outputOptions = {
|
||||
modules: true,
|
||||
chunks: false,
|
||||
cached: false,
|
||||
context: options.context
|
||||
};
|
||||
|
@ -79,14 +77,21 @@ ifArg("sort-assets-by", function(value) {
|
|||
outputOptions.assetsSort = value;
|
||||
});
|
||||
|
||||
ifArg("display-chunks", function(bool) {
|
||||
outputOptions.modules = !bool;
|
||||
outputOptions.chunks = bool;
|
||||
});
|
||||
if(!outputOptions.json) {
|
||||
ifArg("display-chunks", function(bool) {
|
||||
outputOptions.modules = !bool ;
|
||||
outputOptions.chunks = bool;
|
||||
});
|
||||
|
||||
ifArg("display-reasons", function(bool) {
|
||||
outputOptions.reasons = bool;
|
||||
});
|
||||
ifArg("display-reasons", function(bool) {
|
||||
outputOptions.reasons = bool;
|
||||
});
|
||||
} else {
|
||||
outputOptions.chunks = true;
|
||||
outputOptions.modules = true;
|
||||
outputOptions.chunkModules = true;
|
||||
outputOptions.reasons = true;
|
||||
}
|
||||
|
||||
var webpack = require("../lib/webpack.js");
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ Stats.prototype.toJson = function toJson(options, forToString) {
|
|||
var showCachedModules = d(options.cached, true);
|
||||
var showReasons = d(options.reasons, !forToString);
|
||||
var showChildren = d(options.children, true);
|
||||
var showSource = d(options.source, !forToString);
|
||||
var sortModules = d(options.modulesSort, "id");
|
||||
var sortChunks = d(options.chunksSort, "id");
|
||||
var sortAssets = d(options.assetsSort, "");
|
||||
|
@ -129,6 +130,9 @@ Stats.prototype.toJson = function toJson(options, forToString) {
|
|||
return obj;
|
||||
});
|
||||
}
|
||||
if(showSource && module._source) {
|
||||
obj.source = module._source.source();
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
if(showChunks) {
|
||||
|
|
Loading…
Reference in New Issue