Order of creating/merging plugin modules as batch is currently unpredictable. Sort order is defined in JSFilesComparator which only reflects file categorization (module, service, other..). Filename itself is not part of comparison.
Depending on OS directory enumeration which by nature is random is very likely to get random merging order of batch files within same group. That's unpredictable behavior and uncertain/untested behavior. While on Windows it can be considered stable, enumeration on Linux platforms shuffles batch file and creating total chaos.
1) Plugins handle change of load order correctly (hard to implement on existing code)
2) Extend JSFilesComparator to consider filename (for example) as secondary sorting condition (uppercase?). That would almost "fix" ordering of batch files but not completely eliminate issue.
3) Extend plugin definition to have a relative load priority number. A simple file? within plugin dir module.pri, whatever ?
Combination of 2&3 will fix merging order once and forever..