While investigating T170668: "Unknown dependency: wikibase.mobile" on Wikidata element pages I found that OutputPage and ResourceLoaderStartUpModule use different defaults for the resource loader target.
OutputPage uses null (private $mTarget = null;) while ResourceLoaderStartUpModule assumes desktop ($target = $context->getRequest()->getVal( 'target', 'desktop' ); in getModuleRegistrations). This causes all modules (no matter their target) to be added to a page (by OutputPage) which are then not available for loading, as ResourceLoaderStartUpModule is not adding them to the startup module.
- Explicitly set the target, don't allow/ discourage null in MediaWiki
- Make OutputPage also default to desktop
- Change the default to null in ResourceLoaderStartUpModule as well, making all modules available everywhere per default.
I don't know when this started being a problem, but I presume it has not been like this for a long time, as T170668 has only been reported recently.