Last active
February 24, 2017 21:18
-
-
Save benvinegar/0a1a275ba9b5805ea4c434e6f64639c3 to your computer and use it in GitHub Desktop.
Verify your source map mappings locally
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* npm install -g source-map */ | |
var fs = require('fs'); | |
var sourceMap = require('source-map'); | |
var rawSourceMap = fs.readFileSync('./app.js.map').toString(); | |
var smc = new sourceMap.SourceMapConsumer(rawSourceMap); | |
// output original filename, line, column, token for input {line, column} | |
// in built/minified file (e.g. app.min.js) | |
// see: https://github.com/mozilla/source-map#sourcemapconsumerprototypeoriginalpositionforgeneratedposition | |
var pos = smc.originalPositionFor({ line: 1337, column: 1337}); | |
// should see something like: | |
// { source: 'original.js', line: 1, column: 9, name: 'test' } | |
console.log(pos); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment