Last active
February 11, 2024 22:26
-
-
Save unscriptable/4747843 to your computer and use it in GitHub Desktop.
AMD modules that look like CJS Modules/1.1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define(function (require, exports) { | |
var foo = require('foo'); | |
exports.bar = 'bar'; | |
}); | |
// this also works: | |
define(function (require) { | |
var foo = require('foo'); | |
return { bar: 'bar' }; | |
}); | |
// as does this: | |
define(function (require, exports, module) { | |
var foo = require('foo'); | |
module.exports = { bar: 'bar' }; | |
}); |
no, the require
, exports
, and module
are injected when there are no dependencies listed in the define()
, but there are factory params.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Are those appended at the last of the parameter list when there are dependencies?