Skip to content
GitLab
    • Explore Projects Groups Snippets
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Merge requests
  • !1050

Don't strip stack traces of evaluated webpack bundles

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/jameslnewell/master into master 8 years ago
  • Overview 7
  • Commits 4
  • Pipelines 0
  • Changes 1

Created by: jameslnewell

formatWebpackMessages is neat! I'm using it outside of create-react-app. However, it's a little too eager in stripping stack traces from messages.

I'm using the static-react-render-webpack-plugin which evaluates the outputted webpack bundle. When evaluating the outputted webpack bundle throws (in the user's code), the user needs the stack trace to debug what went wrong. formatWebpackMessages is stripping all stack traces making that difficult.

This PR excludes stack traces where the source path contains webpack:. I've created a demo of the regexp working which shows stack traces being stripped for babel-loader but not static-react-render-webpack-plugin.

Example stack trace
static-react-render-webpack-plugin: Error rendering page "scripts/components/compare/couples.js": ReferenceError: Foobar is not defined
    at Couples (webpack:///./components/compare/couples/index.jsx?:37:5)
    at eval (webpack:///../~/react/lib/ReactCompositeComponent.js?:305:16)
    at measureLifeCyclePerf (webpack:///../~/react/lib/ReactCompositeComponent.js?:74:12)
    at ReactCompositeComponentMixin._constructComponentWithoutOwner (webpack:///../~/react/lib/ReactCompositeComponent.js?:304:14)
    at ReactCompositeComponentMixin._constructComponent (webpack:///../~/react/lib/ReactCompositeComponent.js?:279:21)
    at ReactCompositeComponentMixin.mountComponent (webpack:///../~/react/lib/ReactCompositeComponent.js?:187:21)
    at Object.ReactReconciler.mountComponent (webpack:///../~/react/lib/ReactReconciler.js?:47:35)
    at ReactDOMComponent.ReactMultiChild.Mixin.mountChildren (webpack:///../~/react/lib/ReactMultiChild.js?:240:44)
    at ReactDOMComponent.Mixin._createContentMarkup (webpack:///../~/react/lib/ReactDOMComponent.js?:661:32)
    at ReactDOMComponent.Mixin.mountComponent (webpack:///../~/react/lib/ReactDOMComponent.js?:528:29)
Compare
  • master (base)

and
  • latest version
    d6c76f4b
    4 commits, 2 years ago

1 file
+ 5
- 2

    Preferences

    File browser
    Compare changes
packages/react-dev-utils/formatWebpackMessages.js
+ 5
- 2
  • View file @ d6c76f4b

  • Edit in single-file editor

  • Open in Web IDE


@@ -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;
0 Assignees
None
Assign to
0 Reviewers
None
Request review from
Labels
1
CLA Signed
1
CLA Signed
    Assign labels
  • Manage project labels

Milestone
No milestone
None
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
0
0 participants
Reference: facebook/create-react-app!12457
Source branch: github/fork/jameslnewell/master

Menu

Explore Projects Groups Snippets