![](/img/trans.png)
[英]Browserify doesn't translate module.exports to window property?
[英]Why doesn't backbone use module.exports?
為什么主干不使用module.exports?
因為它沒有。 exports
和module.exports
引用相同的對象 :
特別是
module.exports
與exports
對象相同。
如果您可以保存幾個字符進行輸入,那么為什么不這樣做呢?
使用document.getElementById
而不是window.document.getElementById
時,您正在執行相同的操作。 打字更多,不會增加任何好處。
在本教程中,他們使用的是module.exports
因為他們想顯示出口的象征,為什么之間的差額exports
,即
exports.foo = bar;
並覆蓋 exports
對象
module.exports = bar;
您必須使用module.exports
( exports = bar;
不起作用)。
在瀏覽器中考慮像window
一樣的module
。 實際上,它們基本上是一回事。
因此,與瀏覽器中執行的javascript中的window.location === location
相同, module.exports === exports
在節點環境中module.exports === exports
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.