Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Decompile JS into JSX

I wrote an app in React a few months ago and it seems I didn't keep the source JSX code. I have the Babel-compiled JS code.

Is there a way to decompile this back into JSX code? Thank you.

like image 925
Alan P. Avatar asked Apr 24 '17 01:04

Alan P.


1 Answers

If you have the .map files (outputted by default with most bundlers - including Create React App) you can use the npm source-map package to convert those files back to the source.

An example of an AWS Lambda function that makes use of this can be found here

Alternatively if your site is deployed somewhere checkout the Source tab of Chrome devtools - it does the same thing as the package and stitches compiled JS code and source-maps back together.

enter image description here

like image 56
Jonathan Irwin Avatar answered Oct 08 '22 14:10

Jonathan Irwin