Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Expose amplify in AMD format #43

zachleat opened this Issue · 14 comments

11 participants

Zach Leatherman aberman Ted T. Killilea Jim Cowart Andrew Hammond Alexander Beletsky jcreamer898 mariusfilipowski Brian M Hunt Benjamin Cox Doug Neiner
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.


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

Ted T. Killilea
t2k commented


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: 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 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 :)


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.

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).


Oh just saw that I've started another Issue on the same topic... Here is a cool site with help :

Brian M Hunt

:thumbsup: for UMD.

Benjamin Cox

Is this still happening?

Doug Neiner

@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.