COMMUNITY

Import.hx file

Hej all !

Another weird question from the space ! :rofl:

I have a common package for some of my projects organized like that : com.project1, com.project2, and so on. These projects belongs to a same let’s say company.

In all these projects I have a import.hx to ease with imports.

Now, I just wanted to share a class from let’s say project1 to project2, but because of the import.hx in project1, when in my project2 I import the shared class, it imports all the imports it finds in project1’s import.hx.

Because of the specifications of the import.hx file, it’s a normal behaviour, I understand that.

My question is : Why not use something like a Haxe compiler flag or a directive to specify which file to use in the project for “common imports” instead of an “automatic” integration of an import.hx file found by the compiler in a directory ?
Something like that :
build.hxml :

-cp blabla
-import my/file/import.hx
-main Main
-js app.js

I know I could also here use macros to achieve my goal, but maybe this suggestion to specify import.hx file in the build file would be better ?
I mean, like import.hx works today, this file belongs not to a project but to a directory, that’s pitty…

Thanks for reading !