-
Improvement
-
Resolution: Deferred
-
Minor
-
None
-
3.4
-
None
-
MOODLE_34_STABLE
The requirejs.php script, which serves all AMD javascript, works by serving all javascript from all plugins across Moodle.
In many Moodle instances, some plugins are disabled in admin settings. For specialised instances, this could be a large number of plugins. requirejs.php serves JavaScript for all plugins, even if they are disabled.
Moodle JavaScript is already quite large (on moodle.org, first.js is 480KB) so it would be a benefit to serve less of it. For example, if a site does not use the Boost theme, there is no need for them to serve all the Boost javascript.
I propose the following change:
- For most plugin types, where we have a concept/UI for disabling the plugin, do not include the JavaScript in first.js if the plugin is disabled.
- 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).
- Change the UI in admin settings that enables/disables plugins (or edits themelist) so that it also updates the JS revision number - so that if somebody enables a plugin that wasn't previously enabled, users will now download its JavaScript.
In addition to making slight performance improvements, this also reduces the scope of the JavaScript code, which could be useful in special cases when sites need to support legacy browsers that aren't normally supported.
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.
When testing this feature we should confirm that no additional JavaScript loads are caused for a default Moodle install in common pages, i.e. if you have a default install, then either nothing is disabled, or nothing is disabled but where its JavaScript would still be needed!
(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.
- has a non-specific relationship to
-
MDL-53891 bootstrap AMD module executes immediately - even if it is not called
-
- Closed
-
- has been marked as being related by
-
MDL-53891 bootstrap AMD module executes immediately - even if it is not called
-
- Closed
-
- will be (partly) resolved by
-
MDL-66107 Stop bundling all files in first.js
-
- Reopened
-