haxe-modular
haxe-modular copied to clipboard
Can I split a library out?
I've been asked about splitting some dependencies that change rarely, like OpenFL for instance. This is a good idea in principle - such JS could be cached agressively so users don't reload them.
Unfortunately I've hit a few problems regarding code shared between such a library and the rest of the application:
- libraries need to be loaded before modules depending on them; otherwise scope wiring is problematic,
- but libraries need support code (
$hxClasses
,$estr
,$bind
,...) which in some cases must not be duplicated, - which means considering the library code could be needed for the index module we'd need a bootstrap module with the support code.
This all requires a bit of thinking, and probably some non-trivial refactoring...