【问题标题】:Getting jQuery plugin mCustomScrollbar is not a function error with Webpack setup获取 jQuery 插件 mCustomScrollbar 不是 Webpack 设置的函数错误
【发布时间】:2020-03-18 05:01:26
【问题描述】:

我们有使用 Gulp/jQuery 的前端开发环境,并正在尝试将其迁移到 Webpack 上。在运行我们的新设置时,浏览器显示以下带有 jquery.mCustomScrollbar 插件的控制台错误:

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

我们尝试在我们的主包中使用以下方式导入它,但它仍然不起作用:

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

【问题讨论】:

    标签: webpack mcustomscrollbar


    【解决方案1】:

    虽然我们找不到任何解决方案,但 Github 用户 swarty 在以下链接中的评论通过评论 mCustomScrollbar 插件代码中的一些代码帮助我们解决了问题:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-01-07
      • 2023-02-12
      • 1970-01-01
      • 2017-11-13
      • 2019-08-03
      • 2020-09-17
      • 1970-01-01
      相关资源
      最近更新 更多