簡體   English   中英

使用 Webpack 設置獲取 jQuery 插件 mCustomScrollbar 不是 function 錯誤

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

我們有 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');

雖然我們找不到任何解決方案,但 Github 用戶 swarty 在以下鏈接中的評論幫助我們通過在 mCustomScrollbar 插件代碼中評論一些代碼來解決問題:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM