Hi!
One of the stumbiling blocks of using create-react-app with Haxe is that - in spite of everything working fine in the develop environment (yarn start
) - the haxe way of exporting entities isn’t nowadays accepted when building the application for deployment (yarn build
). It then fails with the following output:
$ react-scripts build
Creating an optimized production build...
Failed to compile.
Attempted import error: 'HaxeSomething' is not exported from './path/HaxeModule' (imported as 'HaxeSomething').
error Command failed with exit code 1.
This means that I manually (or post-compile-fix) have to change lines in the generated js output from something like
var HaxeSomething = $hx_exports["HaxeSomething"] = function() { };
to
export var HaxeSomething = $hx_exports["HaxeSomething"] = function() { };
or something like
$hx_exports["HaxeSomething"] = HaxeModule_HaxeSomething;
to
export var HaxeSomething = $hx_exports["HaxeSomething"] = HaxeModule_HaxeSomething;
wich is quite annoying.
Until Haxe gets proper js module export, does anyone have any idea how to get around this without hacking the generated js output?
/ Jonas