named defines and jquery

35 views
Skip to first unread message

Guy Bedford

unread,
Mar 22, 2013, 7:00:08 PM3/22/13
to amd-im...@googlegroups.com
Hi all,

I just wanted to double check what the current consensus is on named define modules. For example that jQuery has a named define define("jquery", ...).

I am looking at running multiple versions of jQuery in a project (this will probably become more common with jquery 2), and in order to do this having named defines in the AMD format doesn't help so much.

Is this set in stone, or are these areas still under debate? I just want to know if I need to work around this in the long term or not.

Also more generally for other modules, are we explicitly encouraging or discouraging this?

Thanks,

Guy

John Hann

unread,
Mar 22, 2013, 9:41:29 PM3/22/13
to amd-im...@googlegroups.com
Hey guy,

Some AMD tools, such as requirejs and r.js, have the ability to manage multiple versions.  check out this: http://requirejs.org/docs/api.html#multiversion

Regards,

-- John


--
You received this message because you are subscribed to the Google Groups "amd-implement" group.
To unsubscribe from this group and stop receiving emails from it, send an email to amd-implemen...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

James Burke

unread,
Mar 22, 2013, 10:57:04 PM3/22/13
to amd-im...@googlegroups.com
On Fri, Mar 22, 2013 at 4:00 PM, Guy Bedford <guybe...@googlemail.com> wrote:
> Also more generally for other modules, are we explicitly encouraging or
> discouraging this?

In general, I try to encourage anonymous modules, but jquery has usage
patterns that make that difficult to support with script src-based
loaders, where the named module works best. Some background here:
https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon

James

Guy Bedford

unread,
Mar 23, 2013, 3:13:11 PM3/23/13
to amd-im...@googlegroups.com
Thank you both.

I was hoping that anonymous modules were the encouraged form, because there is so little flexibility with named defines.

I would rather run multiple versions with different names as opposed to separate contexts, simply because I'd like any other module to be able to easily pick say jquery or jquery2 from within its standard require list, as opposed to needing to find another global require object.

For jQuery, I will probably end up using a forked wrapper to allow this flexibility, I just wanted to be sure this wasn't going against any best practise.

Guy

Reply all
Reply to author
Forward
0 new messages