Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

206
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda