Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Issue in consumer.originalPositionFor method is returning the lineNumber of next line of code in NextJs

Open
#479 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
javascript, next.js
Domain
devtools

Research direction

Start at consumer.originalPositionFor and inspect the supplied lineNumber, columnNumber, and rawSourceMap from the first stack frame. Reproduce with a Next.js-generated chunk and compare mappings around the reported blank lines; done means there is a minimal fixture with a confirmed expected mapping or a documented limitation.

Written by the indexing model from the issue text.

Description

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;
Dominant language
JavaScript
Stars
3.7k
Forks
370
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from mozilla/source-map

All issues in mozilla/source-map

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.