Backtrace the source map file where a minificated error happened

28 Views Asked by At

I am using componentDidCatch at the very top of my app to catch any errors. When they do happen I send a slack message with the information of the error. This information refers to the minified version of the app. Something like this

Error: TypeError: undefined is not an object (evaluating 'cr.researcher.uuid') Message:{"componentStack":"\nq4n@https://production.site.com/assets/index-b3f2d26c.js:1173:5035\nL

I can not replicate the error, therefore I need to back trace the minified location of the error to the component where it happen and try to fix it. I could run a script locally that does the translation, since I have a copy of the source map.

I am using vite for compilation.

I tried to use the npm package, https://www.npmjs.com/package/source-map#consuming-a-source-map, but I can't seem to get it to do the job.

0

There are 0 best solutions below