Skip to content

Commit d231f57

Browse files
onigoetzswengorschewski
authored andcommitted
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
1 parent 7191714 commit d231f57

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

packages/react-dev-utils/WebpackDevServerUtils.js

+5
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,11 @@ function createCompiler(webpack, config, appName, urls, useYarn) {
164164

165165
// If errors exist, only show errors.
166166
if (messages.errors.length) {
167+
// Only keep the first error. Others are often indicative
168+
// of the same problem, but confuse the reader with noise.
169+
if (messages.errors.length > 1) {
170+
messages.errors.length = 1;
171+
}
167172
console.log(chalk.red('Failed to compile.\n'));
168173
console.log(messages.errors.join('\n\n'));
169174
return;

packages/react-dev-utils/formatWebpackMessages.js

-5
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,6 @@ function formatWebpackMessages(json) {
121121
// preceding a much more useful Babel syntax error.
122122
result.errors = result.errors.filter(isLikelyASyntaxError);
123123
}
124-
// Only keep the first error. Others are often indicative
125-
// of the same problem, but confuse the reader with noise.
126-
if (result.errors.length > 1) {
127-
result.errors.length = 1;
128-
}
129124
return result;
130125
}
131126

packages/react-scripts/scripts/build.js

+5
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,11 @@ function build(previousFileSizes) {
121121
}
122122
const messages = formatWebpackMessages(stats.toJson({}, true));
123123
if (messages.errors.length) {
124+
// Only keep the first error. Others are often indicative
125+
// of the same problem, but confuse the reader with noise.
126+
if (messages.errors.length > 1) {
127+
messages.errors.length = 1;
128+
}
124129
return reject(new Error(messages.errors.join('\n\n')));
125130
}
126131
if (

0 commit comments

Comments
 (0)