COMMUNITY

How to avoid unwanted "base" classes in JS output

haxe-js

(Remco Huijser) #1

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
  • haxe.io.FPHelper
  • 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…

Thanks!


(Philippe) #2

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).


(Mark) #3

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?


(Remco Huijser) #4

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?


(Philippe) #5

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


(Remco Huijser) #6

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


(Valentin Lemière) #7

You can search and open issues on github https://github.com/HaxeFoundation/haxe/issues