使用 webpack 获取“Uncaught TypeError: $(...).tablesorter is not a function”

问题描述

在使用 Webpack 迁移到 Rails 6 后,我得到了 Uncaught TypeError: $(...).tablesorter is not a function。这是我的 environment.js

const { environment } = require('@rails/webpacker')

const webpack = require('webpack')
environment.plugins.prepend('Provide',new webpack.ProvidePlugin({
    $: 'jquery/src/jquery',jQuery: 'jquery/src/jquery',tablesorter: 'tablesorter',bootstrap: 'bootstrap/dist/js/bootstrap',draggable: 'plain-draggable'
  })
)

module.exports = environment

其他相关插件工作正常。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)