jquery - Webpack 4 $.fn 未定义
问题描述
我有一个错误。我不能在我的项目中使用 $.fn。所有带有 $.fn 的行都是未定义的。我使用 webpack 来捆绑我的应用程序。我尝试了“expose-loader”,但这也不起作用。
(function ($) {
$.fn.dataTable.Api.register('editor()', function (opts) {
table = this.tables();
setOptions(opts);
drawCallback(table);
drawButtons();
return this;
});
Webpack 4 配置
...
plugins: [
new Webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery',
Tether: 'tether',
'window.Tether': 'tether',
Popper: ['popper.js', 'default'],
})
...
解决方案
推荐阅读
- typescript - 了解 typescript 代码何时完成编译并准备好在浏览器中运行的实际工作流程是什么?
- css - 如何修复 TouchableOpacity 被 SafeAreaView 阻止
- in-app-purchase - 如何在 Spring Boot 项目中从 Apple 服务器通知接收数据
- python - Python解释器在PyCharm中没有显示任何东西
- neovim - 全新安装后找不到配置文件
- typescript - 如何正确创建带有声明的 Typescript NPM 包?
- apache-flink - Apache Flink 1.13 版将表转换为数据集?
- python - 如何列出所有诗歌附加内容的名称?
- python - 在 Pandas 中向左翻转和移动多列数据
- azure - 简单的 Azure 虚拟设备路由