Merge pull request #33937 from jeremejevs/webpack

webpack: Fix startTime and endTime in Stats
This commit is contained in:
Sheetal Nandi
2019-03-18 12:33:52 -07:00
committed by GitHub
2 changed files with 10 additions and 2 deletions
+2 -2
View File
@@ -1131,8 +1131,8 @@ declare namespace webpack {
abstract class Stats {
compilation: compilation.Compilation;
hash?: string;
startTime?: Date;
endTime?: Date;
startTime?: number;
endTime?: number;
/** Returns true if there were errors while compiling. */
hasErrors(): boolean;
/** Returns true if there were warnings while compiling. */
+8
View File
@@ -895,3 +895,11 @@ profiling = new webpack.debug.ProfilingPlugin({ outputPath: './path.json' });
configuration = {
plugins: [profiling]
};
compiler.hooks.done.tap('foo', stats => {
if (stats.startTime === undefined || stats.endTime === undefined) {
throw new Error('Well, this is odd');
}
console.log(`Compiled in ${stats.endTime - stats.startTime}ms`);
});