Skip to content

Commit

Permalink
Make formatWebpackMessages return all messages (#2834)
Browse files Browse the repository at this point in the history
* Move the reduction of the messages to a single place in the place it is used.

* Fix variable name
  • Loading branch information
onigoetz authored and Timer committed Aug 9, 2017
1 parent d009a99 commit badfc2a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions packages/react-dev-utils/WebpackDevServerUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,11 @@ function createCompiler(webpack, config, appName, urls, useYarn) {

// If errors exist, only show errors.
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(messages.errors.join('\n\n'));
return;
Expand Down
5 changes: 0 additions & 5 deletions packages/react-dev-utils/formatWebpackMessages.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,6 @@ function formatWebpackMessages(json) {
// preceding a much more useful Babel syntax error.
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;
}

Expand Down
5 changes: 5 additions & 0 deletions packages/react-scripts/scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ function build(previousFileSizes) {
}
const messages = formatWebpackMessages(stats.toJson({}, true));
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')));
}
if (
Expand Down

0 comments on commit badfc2a

Please sign in to comment.