Brunch 配置文件:exports.config 和 module.exports = config 有什么区别?

Brunch config file: what is the difference between exports.config and module.exports = config?

在 Brunch 网站的指南中,他们启动配置文件如下 module.exports = config:,但是您可以在同一网站上找到的大多数骨架使用另一种语法 exports.config =.

它们有什么区别?都是 javascript CommonJS 模块吗?

我直接看了文档:module node documentation。我一开始就应该做的事情:)

The exports variable that is available within a module starts as a reference to module.exports. As with any variable, if you assign a new value to it, it is no longer bound to the previous value.

If you want the root of your module's export to be a function (such as a constructor) or if you want to export a complete object in one assignment instead of building it one property at a time, assign it to module.exports instead of exports.

最后,他们说:

As a guideline, if the relationship between exports and module.exports seems like magic to you, ignore exports and only use module.exports.

瞧瞧!