From 39ab2a9d34c4c7359da9edd4da8ffcccb042a456 Mon Sep 17 00:00:00 2001 From: Krzysztof Borowy Date: Wed, 8 Nov 2017 13:10:51 +0100 Subject: [PATCH] fix: build time fix (#277) --- src/messages/bundleBuilt.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/messages/bundleBuilt.js b/src/messages/bundleBuilt.js index ed03f58b..baf9b11e 100644 --- a/src/messages/bundleBuilt.js +++ b/src/messages/bundleBuilt.js @@ -8,8 +8,16 @@ import type { WebpackStats } from '../types'; const chalk = require('chalk'); const dedent = require('dedent'); + const path = require('path'); +const getBuildTime = webpackStats => { + const stats = webpackStats.toJson({ timing: true }); + return stats.time + ? stats.time + : Math.max(...stats.children.map(({ time }) => time)); +}; + module.exports = ({ stats, platform, @@ -23,8 +31,7 @@ module.exports = ({ }) => { const heading = stats.hasWarnings() ? chalk.yellow('Built with warnings') - : `Built successfully in ${(stats.toJson({ timing: true }).time / 1000 - ).toFixed(2)}s!`; + : `Built successfully in ${(getBuildTime(stats) / 1000).toFixed(2)}s!`; if (assetsPath && bundlePath) { return dedent`