ES5 Module Systems (was: Alternative proposal to privateName.public)

Jake Verbaten raynos2 at gmail.com
Mon Dec 26 14:02:41 PST 2011


>
> However, I am confused by the "module.exports = ..." part of your
> boilerplate. The main CommonJS wiki seems down at the moment, but looking
> at <http://wiki.commonjs.org.mirrors.page.ca/articles/m/o/d/Modules.html>
> on the mirror site, I could not find any support for this idiom. The
> closest I could find was <
> http://wiki.commonjs.org.mirrors.page.ca/articles/m/o/d/Modules_SetExports_9215.html>,
> which suggests it should read "module.setExports(...);" instead. Where does
> "module.exports = ..." come from?
>

module.exports = ... is a mechanism in node.js to overwrite the exports
object entirely. (useful when you want to export, say a function rather
then an object)

It seems to be similar to module.setExports and is there purely to support
the implementation of the module system in node.js
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20111226/65a7ac2e/attachment.html>


More information about the es-discuss mailing list