Node.js中exports,module.exports以及require方法

在Node.js中,使用module.exports.f = ...與使用exports.f = ...是一樣的,此時exports就是module.exports的一種簡寫方式。但是,需要注意的是,如果直接給exports賦值的話,exports就與module.exports沒有任何關聯了,比如: exports = { hello: false }; // Not exported, on
相關文章
相關標籤/搜索