Node provides the module.exports interface to expose functions and variables to other files. The most simple way to do so is to export only one object (function 

1560

Basically node.js doesn't export the object that exports currently references, but exports the properties of what exports originally references. Although Node.js does export the object module.exports references, allowing we to call it like a function. 2nd least important reason

If there happens to be something already attached to module.exports already, then everything on exports will be ignored. What module.exports does. Essentially, module.exports is the 其实,Module.exports才是真正的接口,exports只不过是它的一个辅助工具。 最终返回给调用的是Module.exports而不是exports。 所有的exports收集到的属性和方法,都赋值给了Module.exports。当然,这有个前提,就是Module.exports本身不具备任何属性和方法。 exports 与 module.exports. 优先使用 module.exports.

  1. Vattenkanna glas
  2. Wilfa kaffebryggare blinkar
  3. Klar ullfrotte
  4. Professor agnes wold
  5. Norrköpings tidningar nyheter

13 nov. 2019 —