Created
June 6, 2017 18:11
-
-
Save brennanMKE/bc25db0713dd12a77affa579e913333b to your computer and use it in GitHub Desktop.
React Native JS Bundle Source Mapping for Debugging
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
var sourceMap = require('source-map'); | |
var convert = require('convert-source-map'); | |
var fs = require('fs'); | |
var source = 'PATH_TO_APP/Myapp.app/main.jsbundle'; | |
var content = fs.readFileSync(source, 'utf8'); | |
var json = convert.fromComment(content).toJSON(); | |
var smc = new sourceMap.SourceMapConsumer(json); | |
var position = smc.originalPositionFor({ | |
line: 701, | |
column: 8 | |
}); | |
console.log(position); |
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
{ | |
"name": "rct_debug", | |
"version": "1.0.0", | |
"description": "Debug React Native", | |
"main": "app.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "Brennan Stehling", | |
"license": "MIT", | |
"dependencies": { | |
"convert-source-map": "^1.5.0", | |
"source-map": "^0.5.6" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment