I'm trying to debug my app created with create-react-app
for the Google bot.
TL:DR: I need to add my error to the DOM so it's visible in the Google bot rendering. The problem is how do I get the same accurate (via source maps) file/line/column numbers that React displays in dev to be displayed in a DOM node.
On Google documentation for debugging rendering, they provide a snippet using a global window.addEventlistener('error')
to add the error to the DOM so it's visible in the rendered screenshot that Google bot generates.
However, when I try this on development, I'm getting this as the first line of the stack trace :
at Home.render (http://localhost:3000/static/js/main.chunk.js:17125:34)
So it's giving me the right function, but the source file and line/column numbers are wrong.
I'm able to see the correct error via the development error display that I assume is something from create-react-app
Notice that it gives the error in src/containers/Home/Home.js
on line 70
compared to the DOM pre output.
Is there a way to get the same accurate result in my DOM pre output ?