Magento – Uncaught Error: Mismatched anonymous define() module in magento 2 .

javascriptjquerymagento2requirejs

I have use mCustomScrollbar jquery plugin but there some error have come & error like:

Uncaught Error: Mismatched anonymous define() module..

Help appreciated.

Thanks.

My mCustomScrollbar jquery plugin code:

define([
    'jquery',
    'mCustomScrollbar',
    'jquery/ui'
], function ($, mCustomScrollbar) {
    'use strict';

    /*mcustomScrollbar plugin code here...*/

});

Best Answer

Call js file in default_head_blocks.xml

#app/design/frontend/yourvendor/yourtheme/Magento_Theme/layout/default_head_blocks.xml

<script src="js/mCustomScrollbar.js"></script>

Place file under /app/design/frontend/yourvendor/yourtheme/web/js

Related Topic