-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use AMD/UMD wrapper on JS libraries #12
Comments
There's an additional layer of trickiness here -- callr.angular requires callr, which requires signalR, which requires jQuery. Because SignalR isn't written with a UMD/AMD wrapper it mucks up the chain to try and actually use require for anything, which breaks a lot of the beauty of using it. There are three possible routes:
In the (presumably) most common case: users are not using a module loader at all. In those cases all three methods will work the same. In the case where users are using a module loader to either build bundles or require files they will have to mess with it in all three cases. Currently on the fence about which direction to go. |
I found a solution for webpack module loader: expose-loader !! the jquery.signalr.js script can be used in webpack loaded env. The solution is to use the expose loader, when loading in the jquery module!
The jquery.signalR.js script is indeed not written as a umd module. Which makes it by default, not to be loadable by webpack. It doesn't require jquery, but assumes that Jquery lives on the global variable window.jQuery. Also if you want to later use signalr by using $, you also will have to use the provideplugin for the jquery module. |
This will allow users to use a module loader or bundler like requirejs, commonjs, browserify or webpack
Using this syntax:
The text was updated successfully, but these errors were encountered: