Is there an implementation of CommonJS / require () that does not use `module.exports`?

Are there any build tools or JS environments that only use exports-variable, and not module.exportswhen you use CommonJS-like require()? (i.e. ignore AMD / RequireJS)

Background
The CommonJS specification defines only a variable exports— it never mentions it module.exports— however, when most people write about CommonJS 1 they assume that it is possible to use module.exports, and not exports, as a popularized Node.js. My overall impression is that most of the so-called "CommonJS" implementations support module.exports.

This applies to me because the UMD template for jQuery-plugins only checks module.exports, while most other CommonJS UMD templates actually check exports-variable (and therefore conform to the CommonJS specification). So which one - can I completely ignore exportsand check only for module.exports- or do I really need to check exportsthat my library supports all possible clients?

References
1 dontkry.com , freecodecamp.com , Brian Leroux , various qaru.site/questions/1665002 / ... Questions

+4
source share

Source: https://habr.com/ru/post/1664998/


All Articles