As much as I’d love to only use pure-Haxe frameworks or existing externs/libs like the excellent
haxe-react or tink libraries, sometimes it makes more business sense to leverage a framework that’s more popular/mainstream, like Ember and Ionic.
It’s been a bit of a pain for me to integrate/target Haxe with/to
ES6/TS frameworks. Yes, you can go down an abstraction level and target
ES5 but then:
- It requires a lot of code transformation through macros or a custom generator;
- You have to figure out existing abstractions at the
TS/ES6levels, such as decorators, figure out the ES5 output, and then make Haxe understand them (perhaps as meta-tags) and spit the right code;
- You often can’t leverage the build system of that framework (example:
ember-cliprocesses ES6 code,
Ionic's build system only supports TS natively). You then often have to re-implement most of the features of the said build system natively in Haxe through macros or a custom generator (as I mentioned in #1 and #2).
The only way to integrate at the
TS/ES6 level at the moment, as far as I know, is to create a custom generator (i.e use and modify
hxgenjs to generate code that can be parsed as
TS, with support for the custom decorators translated from Haxe and such).
I’d love to use Haxe instead without needing to spend a huge amount of time re-implementing aspects of the framework I’m targetting. Because of time constraints and the friction added by the huge upfront time and energy investment of integrating Haxe with these frameworks, I’m often forced to just use the framework native language (
ES6) and skip Haxe altogether.
While it’d be awesome to have a native
TS/ES6 target for Haxe (with first-class support for TS decorators for example), it’s not something that’s available at the moment, unfortunately.
hxgenjs gives hope though, but is it the simplest way to solve this?
I’m looking for insights regarding this. Perhaps someone else smarter than me could shed some light on the issue? The solution could involve
hxgenjs as well, but maybe there are other creative/simpler ways to solve this (the less friction, the better, think how easy it is to integrate ES5 libs with Haxe code through externs, something like this but targetting TS/ES6), or even some plan to have a native
TS target? Any insights appreciated!
Thanks in advance!