Node.js入门 -- 5. module模块对象

module模块对象

  1. module.exports是真正的暴露对象,exports只是它的引用
module.exports.属性 = 值
module.exports.方法 = 函数
module.exports = 对象或函数
  1. module.id 模块ID,模块名称
  2. module.parent 模块的父级模块
  3. module.filename 模块的路径
  4. module.children 模块的子模块
  5. module.paths 模块查找路径,如果当前目录下找不到node_modules就去上一级目录找
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容