DVLP / signalr-no-jquery

120 stars 78 forks source link

$.param is not a function #10

Closed gzoreslav closed 5 years ago

gzoreslav commented 7 years ago

signalR.js:1254 Uncaught TypeError: $.param is not a function at Object.addQs (signalR.js:1254) at Object.prepareQueryString (signalR.js:1232) at hubConnection.fn.init.start (signalR.js:666) at connection._.deferredStartHandler (signalR.js:479)

ES6, WebPack, ReactJS

gtwilliams03 commented 7 years ago

I wish I was better with GitHub and I could do this the right way - but I fixed this by forcing a third party plugin in since the jQueryShim did not include the $.param method - so at line 1254, I changed this:

            if ((typeof qs === 'undefined' ? 'undefined' : _typeof(qs)) === "object") {
                return url + appender + $.param(qs);
            }

to this (I had to install jquery-param in my project to make it work - there is a cleaner way of doing this I am sure...:

            if ((typeof qs === 'undefined' ? 'undefined' : _typeof(qs)) === "object") {
                var param = require('jquery-param')
                return url + appender + param(qs);
            }