Skip to content

Commit

Permalink
fix: build time fix (#277)
Browse files Browse the repository at this point in the history
  • Loading branch information
krizzu authored and satya164 committed Nov 8, 2017
1 parent 501e28c commit 39ab2a9
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/messages/bundleBuilt.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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`
Expand Down

0 comments on commit 39ab2a9

Please sign in to comment.