Quantifying Default Exports

Alexandre Morgaut Alexandre.Morgaut at 4d.com
Tue Jul 29 08:19:44 PDT 2014


Hi Calvin,

On 21 juil. 2014, at 17:16, Calvin Metcalf <calvin.metcalf at gmail.com<mailto:calvin.metcalf at gmail.com>> wrote:

I have a CommonJS module which exports a single function
```js
//cj.js
module.exports = function (){}
```

Just to be exact this wouldn't be exactly a "CommonJS" module
http://wiki.commonjs.org/wiki/Modules

module.exports isn't part of any of the 1.0, 1.1, or 1.1.1 versions of the CommonJS modules specification
CommonJS doesn't support neither to replace the original exports object reference by another, so:
```js
exports = function (){}
```

First implemented in node.js, then in few SSJS implementations to better support node modules
it never was accepted as part of the standard, because considered as too error prone
https://groups.google.com/forum/#!searchin/commonjs/cyclic/commonjs/DECN5h4Lfms/-BrIu7TpKQkJ
and is still not supported by some other CommonJS implementations




[cid:81032e.png at a90d966c.47bea091]
Alexandre Morgaut
Wakanda Community Manager
Email : Alexandre.Morgaut at 4d.com<mailto:Alexandre.Morgaut at 4d.com>
Web :   www.4D.com<http://www.4D.com>

4D SAS
60, rue d'Alsace
92110 Clichy - France
Standard :      +33 1 40 87 92 00


[cid:89448b.png at dd969963.47bf9b71]<http://www.4d.com/fr/company/events/summiteu2014.html>


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140729/318ae413/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 81032e.png
Type: image/png
Size: 4628 bytes
Desc: 81032e.png
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140729/318ae413/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 89448b.png
Type: image/png
Size: 91073 bytes
Desc: 89448b.png
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140729/318ae413/attachment-0003.png>


More information about the es-discuss mailing list