Articles on: Magento 2 Pearl Theme User Guide

Magento 2 Mega Menu - Uncaught TypeError: base is not a constructor

If you’re using the Magento 2 Mega Menu extension, you may occasionally see a console error like this:


Mega Menu console error


This typically results in the menu not functioning (e.g., dropdowns/subcategories won’t open).



Cause


A conflict with a third-party module that also applies a mixin to menu.js. When both your theme/extension and a third-party module mix into the same component but return different structures, JavaScript may throw “base is not a constructor.”



Solution


Edit the mixin.js in the conflicting third-party module so it returns both menu and navigation, not just menu.


Incorrect line (current): return $.mage.menu;


Corrected return object (use this):

return {

menu: $.mage.menu,

navigation: $.mage.navigation

};



Important Notes


  • Apply this change via the Magento customization process (extend/override in your custom module or theme). Do not edit vendor files directly, otherwise updates will overwrite your fix.
  • After making the change:
  1. Redeploy static content: php bin/magento setup:static-content:deploy -f
  2. Flush caches from System → Cache Management (or php bin/magento cache:flush)


Once completed, the Mega Menu functionality should be restored.

Updated on: 17/09/2025

Was this article helpful?

Share your feedback

Cancel

Thank you!