gpt4 book ai didi

Brunch 配置文件 : what is the difference between exports. config 和 module.exports = config?

转载 作者:行者123 更新时间:2023-12-02 04:38:20 24 4
gpt4 key购买 nike

在 Brunch 网站的指南中,他们按照以下方式启动配置文件 module.exports = config:,但是您可以在同一网站上找到的大多数框架使用另一种语法 导出.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.

瞧瞧!

关于Brunch 配置文件 : what is the difference between exports. config 和 module.exports = config?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34860592/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com