简体   繁体   中英

Can I re-construct the original JavaScript source file from a minified version and the corresponding source-map file?

I am working on a project where I have to statically analyse JavaScript code. However, for a few libraries, I only have access to a minified version of the file and the corresponding source-map. Is there a method/technique with which I can generate the original file using these files?

我找到了一个可以帮助做到这一点的 node.js 库: Maximize Corresponding github repo

If your objective is "just" to do a onetime re-construction of the original source code I did it using:

Online Source Visualization

  1. use the "Custom" option
  2. upload compiled file
  3. upload source map file

Depending on filesize it may take a while to view the results.

The correspoding Repo is here

This command line tool is really easy to use

npx uglify-js ugly.js -b --source-map "filename='ugly.js.map'" -o beauty.js

https://www.npmjs.com/package/uglify-js

https://stackoverflow.com/a/70584632/13581139

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM