I forgot about this during the performance review (sorry), but the extension currently registers quite a lot of modules, for all users on every page load:
- mw.externalguidance.init
- mw.externalguidance
- mw.externalguidance.icons
- mw.externalguidance.simulate
- mw.externalguidance.sitemapper
- mw.externalguidance.special
- mw.externalguidance.createpage
From a quick look at how they're used, I think the following there bundles might work:
- Loaded directly on all page views globally – mw.externalguidance.init (as minimal as possible, just a few conditions to load things if and when needed).
- Lazy loaded from page views when needed, by init: mw.externalguidance.
- Loaded directly onto the special page only: mw.externalguidance.special
In addition to these three entry points, there'd be 4) mw.externalguidance.icons which needs to exist as separate module for technical reasons. The rest seems small enough that it'd be beneficial to distribute them together rather than separate. The reason being that every module you register comes at a cost through the startup module – T202154 / https://www.mediawiki.org/wiki/Wikimedia_Performance_Team/Page_load_performance#Size_of_scripts.