OP UPDATED: Paste here some Haxe JavaScript build HXMLs and/or package.json and describe your toolchain

I’ve also been playing with integrating Haxe with Webpack and typescript lately. You can check some of my (WIP) experiments here: haxe-boilerplate · GitHub.

Just be aware that they are mainly a playground at the moment. Some of them use hxgenjs, the others use hxtsdgen to generate TS decl. files. TS can also be used from Haxe by creating externs, though they are not generated automatically like d.ts are atm. They are not really well documented at the moment so feel free to ping me directly if you have questions about them.

I have a more up to date boilerplate that’s supposed to be the product of those experiments. I’ve somewhat successfully integrated coconut.data with plain React (using tsx) through mobx[1]. It uses expressjs in the backend[2]. It provides for a more-or-less sane workflow :). It’s also an example of how to use Haxe and js/ts at the same time in the same project. At the moment the use of webpack is very straightforward and there’s intentionally no use o HMR, although I might look into it later. I hope to share it soon. Actually here’s the repo to my latest TSHX boilerplate experiment: GitHub - fullofcaffeine/fullofcaffeineco-app-boilerplate. I’m working on adding SSR at the moment (from what I see, I’ll need to rework the way the backend is compiled and I’ll need to introduce webapack for the backend too, for it to work*).

You can read more about the motivations behind these experiments here.

*[1] The main reason to do it is because coconut.data is actually very nice for the model layer and while coconut.ui through react works well, it’s still kind of bleeding edge and changing all the time (thanks @kLabz for his awesome work on react-edge though!). I figured it’d be nice to have a way to tap directly into tsx/plain React for UIs and for the rest use Haxe and mix-and-match as needed.

*[2] As I mentioned above, I tried to keep js/ts only in the UI, the rest uses Haxe, even the expressjs web-server. However, I must mention finding good externs for express was a huge pain, and I ended up using the ones from js-kit with some mods to make it work well. It’s still not perfect as you can see here.

1 Like