Skip to content

Commit

Permalink
Don't strip stack traces of evaluated webpack bundles (facebook#1050)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
jameslnewell authored and alexdriaguine committed Jan 23, 2017
1 parent 9fa262f commit 2b789a0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/react-dev-utils/formatWebpackMessages.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,12 @@ function formatMessage(message) {

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

return message;
Expand Down

0 comments on commit 2b789a0

Please sign in to comment.