There seems to be an undocumented Haxe compiler feature that makes it possible to write target/platform specific .hx files by using something like the following filename pattern: Test.js.hx, Test.cpp.hx https://twitter.com/mknol/status/1084941474914058240