Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions packages/react-dev-utils/WebpackDevServerUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ function createCompiler(webpack, config, appName, urls, useYarn) {
// "done" event fires when Webpack has finished recompiling the bundle.
// Whether or not you have warnings or errors, you will get this event.
compiler.plugin('done', stats => {
const compileTime = parseFloat((Math.abs(stats.endTime - stats.startTime) / 1000).toFixed(2));

if (isInteractive) {
clearConsole();
}
Expand All @@ -153,7 +155,7 @@ function createCompiler(webpack, config, appName, urls, useYarn) {
const messages = formatWebpackMessages(stats.toJson({}, true));
const isSuccessful = !messages.errors.length && !messages.warnings.length;
if (isSuccessful) {
console.log(chalk.green('Compiled successfully!'));
console.log(chalk.green('Compiled successfully in ' + compileTime + 's!'));
}
if (isSuccessful && (isInteractive || isFirstCompile)) {
printInstructions(appName, urls, useYarn);
Expand All @@ -162,14 +164,14 @@ function createCompiler(webpack, config, appName, urls, useYarn) {

// If errors exist, only show errors.
if (messages.errors.length) {
console.log(chalk.red('Failed to compile.\n'));
console.log(chalk.red('Failed to compile after ' + compileTime + 's.\n'));
console.log(messages.errors.join('\n\n'));
return;
}

// Show warnings if no errors were found.
if (messages.warnings.length) {
console.log(chalk.yellow('Compiled with warnings.\n'));
console.log(chalk.yellow('Compiled in ' + compileTime + 's with warnings.\n'));
console.log(messages.warnings.join('\n\n'));

// Teach some ESLint tricks.
Expand Down
6 changes: 4 additions & 2 deletions packages/react-scripts/scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@ measureFileSizesBeforeBuild(paths.appBuild)
})
.then(
({ stats, previousFileSizes, warnings }) => {
const compileTime = parseFloat((Math.abs(stats.endTime - stats.startTime) / 1000).toFixed(2));

if (warnings.length) {
console.log(chalk.yellow('Compiled with warnings.\n'));
console.log(chalk.yellow('Compiled in ' + compileTime + 's with warnings.\n'));
console.log(warnings.join('\n\n'));
console.log(
'\nSearch for the ' +
Expand All @@ -72,7 +74,7 @@ measureFileSizesBeforeBuild(paths.appBuild)
' to the line before.\n'
);
} else {
console.log(chalk.green('Compiled successfully.\n'));
console.log(chalk.green('Compiled successfully in ' + compileTime + 's!'));
}

console.log('File sizes after gzip:\n');
Expand Down