Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 2b789a0

Browse files
jameslnewellalexdriaguine
authored andcommittedJan 23, 2017
Don't strip stack traces of evaluated webpack bundles (facebook#1050)
* Don't strip stack traces of evaluated webpack code * Strip stack traces at the end of a string because the last line doesn't always have a `\n` and `create-react-app` is leaving the last line of the stack traces present in the error messages * code comment * code comment
1 parent 9fa262f commit 2b789a0

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed
 

‎packages/react-dev-utils/formatWebpackMessages.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,12 @@ function formatMessage(message) {
101101

102102
// Reassemble the message.
103103
message = lines.join('\n');
104-
// Internal stacks are generally useless so we strip them
104+
// Internal stacks are generally useless so we strip them... with the
105+
// exception of stacks containing `webpack:` because they're normally
106+
// from user code generated by WebPack. For more information see
107+
// https://github.com/facebookincubator/create-react-app/pull/1050
105108
message = message.replace(
106-
/^\s*at\s.*:\d+:\d+[\s\)]*\n/gm, ''
109+
/^\s*at\s((?!webpack:).)*:\d+:\d+[\s\)]*(\n|$)/gm, ''
107110
); // at ... ...:x:y
108111

109112
return message;

0 commit comments

Comments
 (0)
Please sign in to comment.