Getting jQuery plugin mCustomScrollbar is not a function error with Webpack setup

1.7k views Asked by At

We have our frontend development environment with Gulp/jQuery and are trying to migrate it on Webpack. While running our new setup, browser is showing following console error with jquery.mCustomScrollbar plugin :

Uncaught (in promise) TypeError: $cartList.mCustomScrollbar is not a function

We have tried to import it with the following ways in our main bundle, but it's still did not work:

// minified file
require("source/js/vendor/jquery.mCustomScrollbar.concat.min.js");
// and npm packages
require('../core/jquery.mousewheel.js');
require('../core/jquery.mCustomScrollbar');
1

There are 1 answers

0
Rakesh Rawat On

Though we could not find any solution but Github user swarty's comment in the following link helped us resolving the issue by commenting some code in mCustomScrollbar plugin code:

https://github.com/malihu/malihu-custom-scrollbar-plugin/issues/371