I propose the following change:
- For themes, do not include the JS in first.js if the theme is disabled using the 'themelist' admin setting, and all its child themes are also disabled in this way (I don't think themes can be disabled in normal admin settings which is why this uses themelist).
I don't propose any change to how it works when loading single files and in particular, with regard to lazy loading, this should still work even if the plugin is disabled.
(Thanks to Andrew Nicols for some advice about possible issues/details to consider.)
Note: We (at the OU) might have capacity to develop this small change, although I'm not sure whether now or later.