add compile time to statistics
This commit is contained in:
parent
e033f1e9a6
commit
e60514aac1
|
@ -468,6 +468,7 @@ else `stats` as json:
|
|||
``` javascript
|
||||
{
|
||||
hash: "52bd9213...38d",
|
||||
time: 1234, // in ms
|
||||
chunkCount: 2,
|
||||
modulesCount: 10,
|
||||
modulesIncludingDuplicates: 10,
|
||||
|
|
|
@ -8,6 +8,7 @@ module.exports = function(stats, options) {
|
|||
}
|
||||
|
||||
buf.push("Hash: "+c("\033[1m") + stats.hash + c("\033[22m"));
|
||||
buf.push("Compile Time: "+c("\033[1m") + Math.round(stats.time) + "ms" + c("\033[22m"));
|
||||
buf.push("Chunks: "+c("\033[1m") + stats.chunkCount + c("\033[22m"));
|
||||
buf.push("Modules: "+c("\033[1m") + stats.modulesCount + c("\033[22m"));
|
||||
buf.push("Modules including duplicates: "+c("\033[1m") + stats.modulesIncludingDuplicates + c("\033[22m"));
|
||||
|
|
|
@ -154,6 +154,7 @@ module.exports = function(context, moduleName, options, callback) {
|
|||
return webpack(context, moduleName, options, callback);
|
||||
}
|
||||
function webpack(context, moduleName, options, callback) {
|
||||
var startTime = new Date();
|
||||
|
||||
// Defaults
|
||||
if(!options.outputJsonpFunction)
|
||||
|
@ -197,12 +198,15 @@ function webpack(context, moduleName, options, callback) {
|
|||
|
||||
options.loader = options.loader || {};
|
||||
options.loader.emitFile = options.loader.emitFile || function(filename, content) {
|
||||
fileWrites.push([path.join(options.outputDirectory, filename), content]);
|
||||
options.internal.fileWrites.push([path.join(options.outputDirectory, filename), content]);
|
||||
}
|
||||
|
||||
options.internal = {};
|
||||
|
||||
// all writes to files
|
||||
// items: [filename, content]
|
||||
var fileWrites = [];
|
||||
options.internal.fileWrites = fileWrites;
|
||||
|
||||
// Some status info
|
||||
options.events.emit("task", "create ouput directory");
|
||||
|
@ -425,6 +429,7 @@ function webpack(context, moduleName, options, callback) {
|
|||
buffer.warnings = depTree.warnings;
|
||||
buffer.errors = depTree.errors;
|
||||
buffer.fileModules = fileModulesMap;
|
||||
buffer.time = new Date() - startTime;
|
||||
options.events.emit("task-end", "statistics");
|
||||
options.events.emit("bundle", buffer);
|
||||
callback(null, buffer);
|
||||
|
|
Loading…
Reference in New Issue