Add support to be loaded as an AMD module #266

Open
billmag opened this Issue Jun 28, 2012 · 2 comments

Comments

Projects
None yet
3 participants

billmag commented Jun 28, 2012

It'd be great if jquery-ujs defined itself so it could be loaded by RequireJS (http://requirejs.org/) with jQuery as a dependency.

Newer versions of jQuery now support this, so one would be able to list jquery_ujs as a dependency instead of jquery in their modules and require.js would do the right thing.

Member

JangoSteve commented Aug 13, 2012

For now, I'm going to mark this as a potential future enhancement. I'm not opposed to adding AMD support, but I'm cautiously skeptical. The issues with adding AMD support are described in-depth in this thread for underscore.js and [this discussion in sylvester.js[(https://github.com/jcoglan/sylvester/issues/8#issuecomment-7207071).

The short version is, adding AMD support could potentially break applications which happen to be using RequireJS but not for jquery-ujs. This can be avoided by defining some boilerplate to load both the AMD definition and the global namespace, but it's a lot of boilerplate considering you can already use jquery-ujs with RequireJS using the shim config.

leppert commented Dec 4, 2014

@JangoSteve +1 for this. Fun running into you on this thread. Hope you're well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment