webpack-contrib / imports-loader

Imports Loader
MIT License
520 stars 63 forks source link

imports-loader with SignalR JavaScript client #11

Closed ibiza240 closed 9 years ago

ibiza240 commented 9 years ago

Hi, I am trying to use imports-loader along with this library (only available from NuGet) : https://www.nuget.org/packages/Microsoft.AspNet.SignalR.JS/2.2.0 This library is dependent on jQuery.

I have failed to make my import work : var jQuery = require('jquery') var signalR = require('imports?jQuery=jquery!../js/jquery.signalR-2.2.0.js')

and I don't know why :(

I've looked in the signalR library and sometimes $ is used, sometimes jQuery is used or window.$ or window.jQuery

How can I make this import work correctly?

Thanks!

shama commented 9 years ago

I find it easier to just load it globally as many jQuery libraries will expect that:

window.$ = window.jQuery = require('jquery')
var signalR = require('../js/jquery.signalR-2.2.0.js')

Otherwise try:

var signalR = require('imports?window.jQuery=jquery,window.$=jquery!../js/jquery.signalR-2.2.0.js')
ibiza240 commented 9 years ago

Thank you!!

It finally worked with

$ = window.$ = window.jQuery = require('jquery') var signalR = require('../js/jquery.signalR-2.2.0.js')

shama commented 9 years ago

:+1: