Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

204
Views
JavaScript get caller original line number from minified code

I try to implement a small custom logger in our JavaScript project that contains multiple source files. It is minified, but during the development with a full source map. (Webpack: devtool: "inline-source-map")

If I log an error object to the console then I can see the real line numbers. However, if I want to process it and use Error.stack then I get the line numbers from the minified code that is almost useless.

This is my example code:

const err = new Error();
const stack = err.stack;

console.log('Error: ', err);
console.log('Error: ', stack);

And the output:

Error:  Error
    at log (background.ts:18)
    at background.ts:29
    at eventService.ts:170
    at util.ts:124
    ...

Error:  Error
    at log (chrome-extension://hkikkdnnkfiomhblbgonboibnjgkjocp/background.js:735:17)
    at chrome-extension://hkikkdnnkfiomhblbgonboibnjgkjocp/background.js:746:1
    at chrome-extension://hkikkdnnkfiomhblbgonboibnjgkjocp/background.js:889:3
    at chrome-extension://hkikkdnnkfiomhblbgonboibnjgkjocp/background.js:891:12
    ...

Is there a way to get the real source in case of a minified code? Can I get the first error output in a processable manner?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!