HTML5, (java) filesize

When targeting HTML5, my compiled .js file (even in release mode) is always (at least) 1.3mb, even before I start adding assets. Is there anyway to reduce the size of this file (either before or after build)?

Have you tried -final? That turns on dead code elimination.

I haven’t. I’m not familiar with that concept in Haxe + OpenFL. Is this something I need to activate via code or through the command prompt?

Command prompt:

> openfl test html5 -final

HaxeDevelop: Click the window that says “html5,” then add “-final.” (With a space in between, of course.)


Thanks a lot, Player

Ok, I simply added it to the drop down menu and that made a HUGE difference (reduced filesize by about 500%). Thanks so much.

On the topic of filesize, zip your output JS file to get a feeling of how big the download size will actually be. Most (good) servers have Gzip compression enabled automatically. With this in mind, HTML5 tends to be smaller than SWF :slight_smile: