我想在我的React应用程序中使用这个库:http://propeller.in,但它是基于jQuery构建的。我在Index.js React组件中添加了以下相关代码:
import $ from 'jquery';
import 'propellerkit/dist/js/propeller.js';
我也试过这个:
import 'jquery/dist/js/jquery.js';
import 'propellerkit/dist/js/propeller.js';
我确保安装了两个节点模块。出于某种原因,我不断收到$ is not defined
错误。
答案 0 :(得分:1)
如果您使用网络包进行捆绑,则可以使用jquery
提供ProvidePlugin
,
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery' // this will try to find node jquery module
})
链接到docs