Open czyzby opened 8 years ago
I din't had that unreachable code
problem. Are you using haxe 3.2
? I think that I'm using haxe from git, which may lead to different results. I will try 3.2.
To reduce output size I'm using JTransc minimizeNames
option + uglifyjs
manually right now. I have to check if haxe has a minimizing option by itself.
Note that even when minimizeNames option is on, it could be possible to recover field names because there is reflection information. So if you want to avoid people accessing stuff, you should disable reflection for those classes.
minimizeNames allocates small names for classes, methods and fields, while uglifyjs removes all whitespaces. When I implement tree shaking
, output size will improve even more. http://blog.sethladd.com/2013/01/minification-is-not-enough-you-need.html
The console is flooded with
unreachable code after return statement
warnings when runningdistJs
version of the applications. While I'm not sure about the internals of the generated files, but they could sure use some minifying - dead code should be removed, local variables should be obfuscated, unnecessary whitespaces deleted, and so on. Public method/field names obfuscation would probably be dangerous (I'm not sure how you handle reflection, but using fixed naming scheme is certainly one way to do it), but basic minifying is, I think, crucial in the final released application version.