1.3.0 — Jan. 11, 2012 Removed AMD (RequireJS) support from Underscore. If you'd like to use Underscore with RequireJS, you can load it as a normal script, wrap or patch your copy, or download a forked version.
Why have they done it? Does anyone know? Because they added it only few month ago (in October), and AMD (Asynchronous Module Definition) is said to be far superior to CommonJS modules.
Update: As of December 2013, this has been supported again.
Jeremy gave his reasoning in the comments of the commit:
Yep. Not supporting a particular script loader will definitely make it easier for all of them to work properly.
I apologize for merging the support in the first place.
He also tweeted a bit more on the change (link from a later comment):
… because AMD support is breaking regular Underscore embeds on pages that also happen to use Require.js …
The developers of Underscore thought that having AMD support would break support on non-AMD enabled scripts. This is actually not the case, as you can have a script that is both AMD-enabled but also works as-is on a non-AMD deployment.
There is now a drop-in replacement for Underscore: Lo-Dash. Which, along with other features not in Underscore, includes AMD/non-AMD duality.
I felt the need to add to this fairly old question.
Both Backbone and Underscore now support AMD:
- Underscore commit
- Backbone Commit
Discussions (albeit Backbone's one is a bit puzzling as there is a clear discrepancy between the tone of the discussion and the actual outcome):
- Underscore Issue
- Backbone Issue
ES5-shim provides many of the same features as underscore and lodash (array.forEach(), array.map() etc).
ES5-shim natively supports AMD, unlike underscore and lodash, doesn't add extra copies of things your browser probably already provides. Rather it adds native ES5 features to older browsers.
When IE8 and other older browsers die out, you can simply remove the ES5-shim dependency without having to port code like you would with lodash or underscore.