How can I stop jQuery being loaded in Drupal 8, even when modules which use jQuery are on the page?
I have an existing style guide which I'm pulling into a Drupal 8 site. I already have all the JavaScript including jQuery as part of the style guide and I want to keep this separate from Drupal.
For anonymous users everything works fine. However admin users have access to the admin toolbar. This loads in Drupal's own version of jQuery which conflicts with the style guide's and causes the admin toolbar to break.
I tried adding this to my theme's libraries file:
core/jquery: false
core/jquery.once: false
core/jqueryui: false
Inspecting the page it did appear to block some jQuery references but not all of them:
However when I remove my entries from my theme's libraries file I can see that in fact all of the same jQuery files are being loaded, so I don't actually think it achieves anything.
I know that normally one would not load in jQuery themselves and just use Drupal's version, but the style guide requires the latest version and is also consumed by other applications so I cant change it very much.