[HTML5 MINIFY BUG] Bugged in Release mode and not in Debug mode (only happens in HTML5)

Hi singmajesty

I’ve made 2 small games for the html5 target, the games are ready for release so I swtch to “Release” mode and the target to “HTML5 -final” in the FlashDevelop IDE. Then I make one final test and I see that the release mode breaks both games making them unplayable, the games work perfect building with debug mode and “HTML5 -final” as the target.
Also tested the release mode with the Flash target and works perfect as well. So the problem is with the Release mode in the HTML5 -final target.
This is very important for me since the Relase mode with the -final parameter makes the resulting JS file much smaller and loads much faster.
Here you can download the entire project of the 2 games ready to build, play and debug:

The problems caused by the Release mode are the following:

  • The “Sandwich” game click events doesn’t work.
  • The “Photoshop” game has a visual problem, see the screenshots.

Openfl: 3.5.1-LQwi9t
Lime: 2.8.1
Haxe: 3.2.0

Are you using reflect or are you referring to a function or method thru strings?. Minification usually converts something like this,"

public function onRelease

into this public function 1de2

sorry if this reponse is trivial but it happened to me the first time I made minfy.


You might also need to @:keep some things if you get compile errors about fields/values not being found

Sandwich game:
I get a couple of errors in the JS console but I have no idea what function in the Haxe code maps to that error, the minification makes imposible to debug the code.
Photoshop game:
There are no errors in the JS console.
Also I did a “Find And Replace In Files” searching for the word “Reflect” And my code is not using it except for some dead code, I deleted it and the problem is not fixed. Also noticed that openfl and swf libraries are using Reflect. So this is probably a problem in these librearies.
Can you download and check the project? because it seems this problem does not come from my code. There are OpenFL or SWF stuff that breaks on the minification.

Minification seems to be not very stable with Openfl.

Using a tween library like Actuate also uses reflection

I use TweenX and it seems that does not use reflection.

Seems like it does

Why so much reflection in the haxe platform? It’s a little frustrating because I built my classes olways avoiding reflection to not have this kind of problems and now I have them because all the other libraries use it.

I believe it’s based on the basic nature of myClassInstance and { my: "genericObject" } applying the same named fields with new values.

I’d like to make Actuate strictly-typed, I have some ideas, but it’s tricky.

You can @:keep any fields you need dynamic access to, or just reference them in your code somewhere (like var hello = my.fieldToKeep;)