Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get the original line number and symbol from a sourcemap

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?

like image 881
blockhead Avatar asked Jul 29 '14 19:07

blockhead


People also ask

What is inline SourceMap?

Adds source mappings and base64 encodes them, so they can be inlined in your generated file. var generator = require('inline-source-map'); // default charset 'utf-8' is configurable.

How do I debug using SourceMap?

Enter the Sourcemap A sourcemap is a mapping between the generated/transpiled/minified JavaScript file and one or more original source files. The main purpose of sourcemaps is to aid debugging. Basically, if there's an error in the generated code file, the map can tell you the original source file location. That's it.

How do I find source maps?

To enable source maps in Google Chrome, go to Developer Tools, click the little cog icon, and then make sure that “Enable Javascript source maps” is checked. That's it.


1 Answers

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

like image 76
blockhead Avatar answered Sep 21 '22 14:09

blockhead