jrburke/almond — Issue #5: using no deps on define() does not get you require/exports/module for free
Author: pmuellr
Created: 2011-12-07 19:11:29+00:00
State: open

From the AMD spec: https://github.com/amdjs/amdjs-api/wiki/AMD

Under the heading hierarchy "API Specification" -> "define() function" -> "dependencies", is the following note:

> The dependencies argument is optional. If omitted, it should default to ["require", "exports", "module"]. However, if the factory function's arity (length property) is less than 3, then the loader may choose to only call the factory with the number of arguments corresponding to the function's arity or length.

This doesn't seem to work with almond; if I use:

define("a", function(require,exports,module){...})

all of `require`, `exports`, and `module` are null-ish, but if I use

define("b", ["require","exports","module"], function(require,exports,module){...})

then things seem to work correctly