3 ms·
I usually use just `module.export = {...}` in the bottom line when I want to export object by object literal. To be honest, I'm not quite sure about commonJS r
by smagch 14y ago
I usually use just `module.export = {...}` in the bottom line when I want to export object by object literal.
To be honest, I'm not quite sure about commonJS require implementation of nodeJS. But as long as I'm understand,
1. Use `module.exports` if you want to assign exports by object literal
2. Use `exports.[key]` if you want to assign exports brick by brick.
3. Use `exports = module.exports = {...}` or `module.exports = exports` if you want to ensure both functionality; you can assign `exports.[key] after assign exports by object literal.