A lot seems to have happened since my last visit here !
But now I’m a bit confused about it all. Maybe someone can explain this a little bit, or point me to some info ?
Is npm 100% parallel to haxelib, or is it only meant for web targets ?
In the future, will we need 2 separate projects if we want for example the windows target (exe) and a demo we can play in a web browser ?
The NPM version is only meant for web targets.
Web targets will always also be available via Haxe / Haxelib (the NPM version still uses Haxe to compile OpenFL sources to JS). So when it comes to what you can target, the NPM version is strictly inferior.
And is there an obvious reason why one might want to use npm over haxelib (specifically for games) ?
Not from my perspective - I really like Haxe, and as mentioned, you’re really just locking yourself in to a small subset of OpenFL’s possible targets with the NPM version… Some people might prefer JS/TS and the NPM ecosystem over Haxe though? ¯\(ツ)/¯
I also quite like Haxe and OpenFL. But I’m getting a bit worried that all this extra ‘stuff’ might be getting a bit much for one person to maintain …
NPM releases have a version of OpenFL that is already compiled. This makes OpenFL’s sources external to your project, which makes OpenFL compatible (and available) on a CDN, and is good for multiple embeds. You have a few minor things you can do that aren’t available in the Haxelib releases, such as
var stage = new Stage (550, 400);
var sprite = new Sprite ();
sprite.graphics.drawRect (0, 0, 100, 100);
They also use Webpack, which together with NPM makes integrating external code easier, uses local installs of Haxe, and supports hot-reloading, so
npm start -s launches a browser window, recompiles your code automatically when changed, and refreshes the browser window, too. This alone is nice for development.
Thank you for explaining !
Although I can’t say I understood it all … To an inexperienced programmer it’s all starting to look a bit like magic.