Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Validate and get actual line number of the stacktrace using source map
// Purpose:
// To validate the source map
// To get actual line number of the stack trace
// Usage:
// You need to do following
// 1. Copy the source map to the directory where you have this script.
// 2. Change source map file in the `fs.readFile` method.
// 3. Install source-map package
// npm install source-map
// 4. Specify the minified line number and column number and 'Save'
// 5. Run the script
// node sourcemap-checker.js
var sourcemap = require('source-map'),
fs = require('fs');
fs.readFile('./', 'utf8', function (err, rawSourceMap) {
if (err) {
return console.log(err);
var smc = new sourcemap.SourceMapConsumer(rawSourceMap);
// List all sources
line: 4, // Specify minified file line number
column: 275 // Specify minified file column number
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment