How to avoid unwanted "base" classes in JS output

We were checking the JS output our project generates the other day and noticed that there is a lot of unwanted/unused code being generated even though DCE = full is used.

Things we encounter:

  • The Haxe Error which is never used in our (generated) code
  • Std.String even though this is also not used in our (generated) code
  • All classes get a name = true flag added

What would be the most suitable way to avoid this kind of output. Adding it all together results in quite a lot of js code…


1 Like

Are you absolutely sure they aren’t used?

These elements are added based on code features, so there may be an error but they are needed as soon as you use a little bit of Reflection (and something else for the FPHelper).

Which Haxe version do you use? Can you try adding -D analyzer-optimize to your build parameters if you are using Haxe 3.4 or higher?

I am using Haxe 4 release 3. I am quite sure that haxe_io_Error and haxe_io_FPHelper are in there while they are not being used.

Tried -D analyzer-optimize but this is default behavior in version 4, right?

Then it might be worth raising an issue if it’s not a known one.

Hi Philippe: where is the best way to do this?

You can search and open issues on github Issues · HaxeFoundation/haxe · GitHub