Skip to content
This repository

Expose amplify in AMD format #43

Open
zachleat opened this Issue January 03, 2012 · 14 comments
Zach Leatherman

Now that jQuery is exposing itself w/ define, I feel like this will catch on more.

The easiest implementation would be:

define('amplify', function()
{
return amplify;
});

But the most correct would be to not use a global variable at all if an AMD loader exists on the page (underscore.js does a good job of this, I believe).

This allows amplify to be loaded using RequireJS or equivalent.

aberman

I second this issue and would love to see it done. Thanks!

Ted T. Killilea

Yuuuuuuuuuup

Jim Cowart

Bumping this to update everyone - the current plan is to write in AMD support - at least starting with the combined core/store/request build output. Are any of you using custom amd wrappers around the individual amplify libs? What about using amplify in projects that are mixing amd and standard js libs? (I ask that last one b/c some of the amd wrappers can have some issues in hybrid projects)....

Zach Leatherman

Custom amd wrappers around individual amplify libs: no.
Using amplify in projects that are mixing amd and standard js libs: yes.

Not sure how that relates to amplify's amd support though.

Andrew Hammond

This seems to work for me:

https://gist.github.com/2137980 via ifandelse

Jim Cowart

@andrhamm - glad that's working. I noticed the version says 1.0.0, but it looks like the 1.1.0 code base, and when I created that gist, that's what I would have pulled...so...my bad on the wrong version in the comments. I have the AMD build pieces working locally, just need to dot my i's and cross my t's on a few things (including tests) before I submit the pull req and get it merged in...

Alexander Beletsky

@andrhamm thanks a lot, that works indeed! will be using your version, at least till new version of amplify with AMD support available :)

jcreamer898

As of RequireJS 2.0, it is now possible to use non-amd modules in a project via the shim config in require.config.

Here is a gist of the working code.

https://gist.github.com/3107540

Hopefully that will help!

Jim Cowart

The shim that @jcreamer898 is talking about should work for most situations (both full AMD and hybrid projects). We will still produce an amd-compliant build at some point in the near future since a true amd version will pull amplify out of the global scope (since the shim wouldn't).

mariusfilipowski

Oh just saw that I've started another Issue on the same topic... Here is a cool site with help :
https://github.com/umdjs/umd/

Brian M Hunt

:thumbsup: for UMD.

Benjamin Cox

Is this still happening?

Douglas Neiner
Owner

@benjamincox Yes… I apologize for the slow inclusion of this feature. I need to get the roadmap sketched out for Amplify so we can move it forward in a more focussed way.

Benjamin Cox
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.