14

I'm logging javascript errors from my site, but the files are minimized so I don't get meaningful line numbers. I do have source maps, however.

Is there a service, script, npm module, or anything that can help me "translate" the line numbers from the minified versions into something useful?

blockhead
  • 9,655
  • 3
  • 43
  • 69
  • Do you have a test/integration environment with non-minified JS that you can reproduce those errors in? – admdrew Jul 29 '14 at 19:19
  • Of course I do, but a basic part of error logging is reading stacktraces...do you not agree? – blockhead Jul 29 '14 at 19:27
  • I'm just wondering if what you need is required for production, given the 'answer' is just beautified JS. – admdrew Jul 29 '14 at 19:28
  • I have a system in production, and a stacktrace from a bug on production. Obviously I need to be able to reproduce it. I'm asking how I can effectively read my stacktrace. – blockhead Jul 29 '14 at 19:37

1 Answers1

8

I have found the answer using this npm module:

https://www.npmjs.org/package/source-map

Edit Feb 1st, 2015

Found the following project which handles this: https://github.com/epeli/source-map-peek

blockhead
  • 9,655
  • 3
  • 43
  • 69
  • 1
    Thanks for doing this research. It helps. Better, but I really want to be able to log source locations at the client, when the client gets an error. The WebPack/Babel config module.exports.devtool has a value 'nosources-source-map' designed for production; it provides file-name and line-number detail, without giving away the source code. In the debugger, it works fine. But my clients are not in the debugger. On error, my code pops a window, asking user to copy and paste into an email. That stack-trace is my lifeline. I need filename and line number there. But string is just min info. – IAM_AL_X Aug 21 '20 at 17:51