admin管理员组文章数量:1289632
I found a post back in 2012 that has similar problems, but it invokes uglifyjs differently
Uglify-js doesn't mangle variable names
I have a Windows 7 environment, uglifyjs 2 installed via npm and post How to install node modules globally?
I call uglify as follows:
uglifyjs --press dead_code=true --mangle --mangle-toplevel -- x.js > x-min.js
My code crunches (from 127kb to 55kb) but when I open my code, I find function and variable names are original.
The browser demo tool gives the same results.
Anyone care to advise how I can obfusicate variable and function names with, or without uglify ?
I found a post back in 2012 that has similar problems, but it invokes uglifyjs differently
Uglify-js doesn't mangle variable names
I have a Windows 7 environment, uglifyjs 2 installed via npm and post How to install node modules globally?
I call uglify as follows:
uglifyjs --press dead_code=true --mangle --mangle-toplevel -- x.js > x-min.js
My code crunches (from 127kb to 55kb) but when I open my code, I find function and variable names are original.
The browser demo tool gives the same results.
Anyone care to advise how I can obfusicate variable and function names with, or without uglify ?
Share Improve this question edited May 23, 2017 at 12:32 CommunityBot 11 silver badge asked Jul 30, 2016 at 16:04 user4278933user4278933 2- 2 What about function arguments and internal variables? Are they minimized? Uglifying public functions and variable names typically cause problems when accessing from other scripts or html. You can find some alternitives on the uglify website lisperator/uglifyjs. I got really good results using jspacker which may also be an alternative: dean.edwards.name/packer – Wolfgang Commented Jul 30, 2016 at 16:21
- this seams to be relevant for top-level names: stackoverflow./questions/10959154/… – Wolfgang Commented Jul 30, 2016 at 16:28
1 Answer
Reset to default 12You're mentioning using UglifyJS2.
The option --mangle-toplevel
or -mt
es from UglifyJS.
There is no --mangle-toplevel
option in UglifyJS2.
In UglifyJS2, to enable the mangler, you need to pass the --mangle
or -m
option. It accepts the following (ma-separated) options:
- toplevel
- eval
So, in your case, you'll need to use --mangle toplevel
.
本文标签: javascriptuglifyjs compresseses but does not mangle function or variable namesStack Overflow
版权声明:本文标题:javascript - uglifyjs compresseses but does not mangle function or variable names - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741398137a2376498.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论