Commit badfc2a8 authored by Stéphane Goetz's avatar Stéphane Goetz Committed by Joe Haddad
Browse files

Make formatWebpackMessages return all messages (#2834)

* Move the reduction of the messages to a single place in the place it is used.

* Fix variable name
parent d009a990
Showing with 10 additions and 5 deletions
+10 -5
...@@ -164,6 +164,11 @@ function createCompiler(webpack, config, appName, urls, useYarn) { ...@@ -164,6 +164,11 @@ function createCompiler(webpack, config, appName, urls, useYarn) {
// If errors exist, only show errors. // If errors exist, only show errors.
if (messages.errors.length) { if (messages.errors.length) {
// Only keep the first error. Others are often indicative
// of the same problem, but confuse the reader with noise.
if (messages.errors.length > 1) {
messages.errors.length = 1;
}
console.log(chalk.red('Failed to compile.\n')); console.log(chalk.red('Failed to compile.\n'));
console.log(messages.errors.join('\n\n')); console.log(messages.errors.join('\n\n'));
return; return;
......
...@@ -121,11 +121,6 @@ function formatWebpackMessages(json) { ...@@ -121,11 +121,6 @@ function formatWebpackMessages(json) {
// preceding a much more useful Babel syntax error. // preceding a much more useful Babel syntax error.
result.errors = result.errors.filter(isLikelyASyntaxError); result.errors = result.errors.filter(isLikelyASyntaxError);
} }
// Only keep the first error. Others are often indicative
// of the same problem, but confuse the reader with noise.
if (result.errors.length > 1) {
result.errors.length = 1;
}
return result; return result;
} }
......
...@@ -122,6 +122,11 @@ function build(previousFileSizes) { ...@@ -122,6 +122,11 @@ function build(previousFileSizes) {
} }
const messages = formatWebpackMessages(stats.toJson({}, true)); const messages = formatWebpackMessages(stats.toJson({}, true));
if (messages.errors.length) { if (messages.errors.length) {
// Only keep the first error. Others are often indicative
// of the same problem, but confuse the reader with noise.
if (messages.errors.length > 1) {
messages.errors.length = 1;
}
return reject(new Error(messages.errors.join('\n\n'))); return reject(new Error(messages.errors.join('\n\n')));
} }
if ( if (
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment