【发布时间】:2021-07-24 13:34:40
【问题描述】:
我正在使用 Yarn 和 jQuery 开发 Symfony5 项目。当我尝试将 jQuery 插件“isotope-layout”与 Webpack Encore 一起使用时出现错误。
我尝试修复它好几个小时,但我可能做得不对。
这是我的代码:
webpack.config.js
// Same error with or without "autoProvidejQuery"
Encore.autoProvidejQuery();
app.js
import 'jquery';
import 'popper.js';
import 'bootstrap';
import 'isotope-layout';
// start the Stimulus application
import './bootstrap';
custom.js
import jQuery from 'jquery';
import 'isotope-layout';
(function ($) {
// Here is the error :
$(...).isotope({...});
})(jQuery);
错误:
Uncaught TypeError: $(...).isotope is not a function
【问题讨论】:
标签: javascript jquery yarnpkg jquery-isotope webpack-encore