admin管理员组文章数量:1305127
I have a list of .js files and I have a single minified version of these files with the source map. The minified file has been created using UglifyJS
Is it possible to extract code of the individual js files from the minified file? maybe by reading the source map?
eg:
original files:
1)head.js
2)tail.js
3)stomach.js
4)liver.js
minified file (containing code of all of above files):
-> body.min.js
source map:
-> body.min.js.map
Is it possible to extract the minified code (string) of stomach.js from body.min.js?
I have a list of .js files and I have a single minified version of these files with the source map. The minified file has been created using UglifyJS
Is it possible to extract code of the individual js files from the minified file? maybe by reading the source map?
eg:
original files:
1)head.js
2)tail.js
3)stomach.js
4)liver.js
minified file (containing code of all of above files):
-> body.min.js
source map:
-> body.min.js.map
Is it possible to extract the minified code (string) of stomach.js from body.min.js?
Share Improve this question asked Mar 16, 2016 at 14:02 Imraan KhanImraan Khan 3751 gold badge3 silver badges9 bronze badges 3- This is an interesting question. Can you provide a little context? Are you afraid someone else will reverse engineer your code? Are you trying to reverse engineer someone else's code? Have you lost the original files and are attempting to restore them from the minified versions? – JDB Commented Mar 16, 2016 at 14:08
- Basically I want to generate some code on runtime. the final code might not include code from all files. And I also want to avoid running a minification of the final code – Imraan Khan Commented Mar 16, 2016 at 14:18
- Then why bine the files in the first place? I think extracting code is going to be far more expensive then minifying it. If you minify each file individually, wouldn't that give you the best of both worlds? You can bine as needed without having to minify at runtime. – JDB Commented Mar 16, 2016 at 14:21
1 Answer
Reset to default 11This script will expand minified source (via give sourcemap), and recreate all the files; essentially mirroring the original source repo. Is this what you needed? Quick and dirty, but might do the trick. (only tested against sourcemaps derived from webpack)
https://gist.github./hooptie45/6f9a7e6251a120c8d2d04e75f9d73c0e#file-sourcemap-extract-rb
$ ./sourcemap-extract.rb site./assets/app.min.js.map ./tmp
本文标签: nodejsExtract individual javascript file code from minified fileStack Overflow
版权声明:本文标题:node.js - Extract individual javascript file code from minified file - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741777274a2397100.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论