I'm trying to use a JQuery Plugin (SignalR) inside my React application.
What I did is :
- Install jquery via npm ;
- Install the signalr client via npm ;
- Add entries in webpack.config to specify jQuery and SignalR paths ;
- Use
import $ from 'jquery'
andimport 'msSignalrClient'
in the React component I want to.
But that doesn't seem to work as I get this error : jquery.signalR.min.js?dc9f:9Uncaught Error: jQuery was not found. Please ensure jQuery is referenced before the SignalR client JavaScript file.
One workaround that works is to load in jQuery like this inside my index.html
: <script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
. Of course it's not optimal at all, and I'd like to import jQuery with the method I explained above. Any help appreciated !