JS Source Maps for Project with Lazy Loading

Vladyslav

Posted on
Jan 10 2025

Hello, Raygun Team 👋

Context: Web App Tech Stack: React, Vite, TS, Raygun

I'm trying to add JS source maps to our project that supports lazy loading, which means main bundle is split into more than 40 chunks at the moment (and could be even more) and source maps are generated to each file accordingly.
I've successfully uploaded all the chunks and source maps to Raygun via https://api.raygun.com/v3 dedicated endpoint, and raised the error to see the result. Unfortunately, it seems Raygun can't correctly point the line of code where error appears:
✅ I can see the file name identified correctly. The error occurred in the file Raygun highlighted.
❌ The row number is incorrect. The error occurred on couple of lines above.

See the attached screenshots
ℹ️ raygun-logging-code.png shows the component and lines of code present in the file.
ℹ️ raygun-error-trace.png demonstrates the issue on Raygun side where error is shown for incorrect line of code.

⚠️ Note
The same behaviour and exactly the same logic works fine for another our project where we do not use lazy loading and have 1 JS bundle and 1 source map file.


Reply