One of the main issues people seem to have on Meta is broken plugins. There is a natural assumption that ‘disabling’ a plugin in the admin interface will stop any issues caused by it. The reality is that plugin javascript is still loaded, and can still completely break Discourse.
I have a working PR which ‘fixes’ this behaviour.
If you’ve ever looked at the plugin_third_party.js
file, you’ll know it looks something like this (eval
only used in development, but similar idea in production)
I’ve added a pre-processor which wraps those definitions so they end up like this:
Then, before the application starts up, discourse.js
steps through each one of those definitions, and will ignore any definitions for disabled plugins. (we already have a list of disabled plugins client-side for automatically disabling plugin outlets).
As far as I can tell locally and on my instance, it works great. I can deliberately add a broken “import” line to a plugin file, see that the site is broken, go and disable the plugin, and then the site works again
Is this the right approach to be taking?