I've got NSBundle file named main.jsbundle packaged by react-native bundle, which tool I can use to explore it's contents? I can see that it got the minified js code inside, and also some sort of index at the beginning of file. I need to extract the js code in order to debug an issue.
2 Answers
NSBundle
is a totally different thing – it is a native class representing an Apple format of packaging applications and frameworks, allowing to access and manipulate it from native code.
You are asking about a React Native bundle, which is quite a loose concept of a single file of minified JS code + an assets folder for images and data. You can actually de-minify the js-bundle using conventional tools such as uglify-js and try to inspect it.
You can also use sourcemaps produced by Metro, and maybe metro-symbolicate to understand how the minified code from the bundle maps to actual sources, although I can't recommend anything more specific without knowing the problem at hand. There is also no documentation for metro-symbolicate
, meaning you'll have to grok its sources.

- 2,004
- 1
- 16
- 25
-
it is a bit different from a browser js bundle, because there's a bunch of binary data at the beginning of the file. I found that piping the file thru `strings` does the trick of stripping that binary data for me – Ilia Sidorenko May 04 '20 at 07:42
-
Are you using RAM bundles then? – ivanmoskalev May 04 '20 at 09:22
-
I think I actually do yeah, I remember setting up something like that. – Ilia Sidorenko May 05 '20 at 04:01
As @ivanmoskalev pointed out, this might not be necceserily NSBundle. Anyway, piping the file through strings
outputs pretty much just the javascript part of the file, so that works for me.

- 2,157
- 3
- 26
- 30