Ultimate Theme Magento 2.3.5, fix for compat.js error/warning in developer tools

The issue

When using the Ultimate theme in Magento 2.3.5, developer tools give a compat.js warning about the usage of jQueryUi. In short, because Magento doesn’t know which modules are necessary, all are loaded. Hence the warning that this may affect performance.

Not only that, in some cases the navigation of the main (mega) menu stops working, or the accordeon on the side navigation. Or other issues. Ultimo theme is nice, but it seems that developers aren’t responding anymore. I doubt there will be any updates. But hopefully they do. Their latest version on themeforest was adjusted for 2.3.1.

How, what, where

In Chrome, it is possible to click on the compat.js warning, to expand the message. That will give hints as to which files or scripts call for jQueryUi functionality. Remember this one, in case your situation needs more adapting. Cudos to ‘Black’ on this stackexchange post.

Anyway. It took me quite some time to find this one, and I am still not sure if this is the correct way to go. But hey! it works – for now, using Magento 2.3.5. If you have any suggestions to improve, let me know in the comments or e-mail me.

Enough, lets’ fix this!

Which js files are loaded, is defined in files requires-config.js

So, using developer tools I narrowed it down to two files to adjust.

The first file is
app/code/Infortis/Base/view/frontend/requirejs-config.js
This is what I changed it to:

var config = {
paths: {
'smartheader': 'Infortis_Base/js/smartheader',
'stickyheader': 'Infortis_Base/js/stickyheader',
'qtycontrol': 'Infortis_Base/js/qtycontrol',
'expandingsearch': 'Infortis_Base/js/expandingsearch'
},
shim: {
'smartheader': {
deps: ['jquery', 'mage/dropdown', 'enquire']
},
'stickyheader': {
deps: ['jquery', 'jquery-ui-modules/effect', 'enquire']
},
'qtycontrol': {
deps: ['jquery', 'jquery-ui-modules/core']
},
'expandingsearch': {
deps: ['jquery', 'jquery-ui-modules/core']
}
}
};

The second file is
app/code/Infortis/UltraMegamenu/view/frontend/requirejs-config.js
This is what I changed it to:

var config = {
paths: {
'ultramegamenu': 'Infortis_UltraMegamenu/js/ultramegamenu'
},
shim: {
'ultramegamenu': {
deps: ['jquery', 'jquery-ui-modules/accordion', 'enquire', 'uaccordion']
}
}
};

So, as you see, I replaced the jQueryUi references to seperate modules.
These modules can be (and should be!) found in the following directory:
/lib/web/jquery/ui-modules

So that’s it! As I mentioned above, this may not be the cleanest or best solution to fix it, but for me it worked and then I stopped bothering. You may want to override changes in your custom theme, but since I doubt there will be any future updates for Ultimo, I decided to change it at the locations mentioned.

Do you have any improvements? Let me know in the comments below or e-mail me.

Happy fixing!

By the way, see here for a fix for the missing category breadcrumbs in Ultimo for Magento 2.3.5