So, I have implemented the source-map package and I am trying to find the lineNumber and originalFile of the production error from the JS chunk. I have implemented in in create-react-app and it's working fine.
But when I am implementing it in NextJS it's returning the lineNumber of the next piece of code where the error is getting generated.
For eg: If the error is introduced in lineNumber 45 and then next piece of code is written in lineNumber 50, in between line number 45 and 50 is space then I am getting line Number as 50 from consumer.originalPositionFor.
Implementation Details:
Implemented Source Map package like this :
rawSourceMap -- is the source map file for JS chunk where the error occurred.
Getting this info from the first frame of the error stack trace.
const consumer = await new SourceMapConsumer(rawSourceMap);
const originalPosition = consumer.originalPositionFor({
line: lineNumber,
column: columnNumber,
});
return originalPosition;
So, I have implemented the
source-mappackage and I am trying to find the lineNumber and originalFile of the production error from the JS chunk. I have implemented in in create-react-app and it's working fine.But when I am implementing it in NextJS it's returning the lineNumber of the next piece of code where the error is getting generated.
For eg: If the error is introduced in lineNumber 45 and then next piece of code is written in lineNumber 50, in between line number 45 and 50 is space then I am getting line Number as 50 from
consumer.originalPositionFor.Implementation Details:
Implemented Source Map package like this :
rawSourceMap -- is the source map file for JS chunk where the error occurred.
Getting this info from the first frame of the error stack trace.