Getting this error when using with create-react-app
ReferenceError: jQuery is not defined
I have this in my index.js
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
//import '../node_modules/jquery/dist/jquery.min.js';
import jQuery from 'jquery';
import '../node_modules/product-xxx/dist/js/product-xxx.min.js'; // this file uses jQuery
I already tried still no use
/* eslint-disable import/first */
window.jQuery = window.$ = $;
This works if I load jQuery from CDN in the public/index.html jQuery version is 3x
Any pointers?
Update
jQuery is used in the module product-xxx like this
+function(t) {
"use strict";
function e() {
var t = document.createElement("bootstrap")
, e = {
WebkitTransition: "webkitTransitionEnd",
MozTransition: "transitionend",
OTransition: "oTransitionEnd otransitionend",
transition: "transitionend"
};
for (var i in e)
if (void 0 !== t.style[i])
return {
end: e[i]
};
return !1
}
t.fn.emulateTransitionEnd = function(e) {
var i = !1
, o = this;
t(this).one("bsTransitionEnd", function() {
i = !0
});
var n = function() {
i || t(o).trigger(t.support.transition.end)
};
return setTimeout(n, e),
this
}
,
t(function() {
t.support.transition = e(),
t.support.transition && (t.event.special.bsTransitionEnd = {
bindType: t.support.transition.end,
delegateType: t.support.transition.end,
handle: function(e) {
return t(e.target).is(this) ? e.handleObj.handler.apply(this, arguments) : void 0
}
})
})
}(jQuery)