I am using an error boundary component to catch react errors and it works fine.
My problem is that in the production app the logging is kind of useless since the component stack looks like this:
\n in t\n in t\n in t\n in t\n in t\n in div\n in t\n in u\n in n\n in t\n in t
While in development environment the component stack is way more usable:
in ErrorPage (created by Route)\n in Route (at Routes.js:60)\n in Switch (at Routes.js:46)\n in Router (created by BrowserRouter)\n in BrowserRouter (at Routes.js:45)\n in div (at Routes.js:43)\n in ThemeProvider (at theme.js:1262)\n in Theme (at Routes.js:42)\n in Provider (at Routes.js:41)\n in ErrorBoundary (at Routes.js:40)\n in Routes (at index.js:12)
The same happens with the message. In production we get:
t.value (http://localhost:3333/static/js/main.5a3e606e.js:1:680858
While in dev:
Uncaught TypeError: Person is not a constructor
at ErrorPage._this.click2 (ErrorPage.js:12)
Is there a way to make react errors map to the source code and make the logging actually usable in production?
UPDATE: I am using a library called http://js.jsnlog.com/ that handles the logs and actually catches everything (Even event handlers). This is how the Boundary component looks like https://pastebin.com/aBFtD7DB. The problem is not catching the errors, but that in production they are useless.