CommJs中的module.exports 和 exports 和 ES6 中的 export 和 export default 之间的区别
module.exports 和 exports
这两个是属于 Node.js中的导出模块的方法
module.exports
module.exports属性表示当前模块对外输出的接口,其他文件加载该模块,实际上就是读取module.exports变量。
exports
为了方便,Node为每个模块提供一个exports变量,指向module.exports。这等同在每个模块头部,有一行这样的命...
原创
2019-11-23 15:59:09 ·
224 阅读 ·
0 评论