# flatten package namespaces to single variables
-D js_flatten
# remove all unused code
-dce full
# remove all traces
--no-traces
The Haxe output is then ready to be minified afterwards.
We use these flags and the Reflect-API within our code to be compatible to Google Closure Compiler. In advanced mode it delivers the best minification result. And if it's important to you - it's quite hard to read too.
Just to give you an idea how good the minification results are here some figures of one of our complex runtimes:
application-debug.js (565KB - 74KB gzip) (raw Haxe output)
application-uglify.js (244KB - 52KB gzip)
application-closure.js (156KB - 42KB gzip)
Notice that gzipped savings aren't that big - but since we can't assume every server supports it and is set up correctly - we use closure compiler.
Our Haxe codebase is quite big so we don't minify during development but before testing. Maybe this info helps a little...