facebookarchive/prepack

Generate CommonJS Module Compatible Output

開放

#451 建立於 2017年4月25日

 (2 則留言) (0 個反應) (0 位負責人)JavaScript (520 個分叉)batch import
enhancementhelp wanted

倉庫指標

星標
 (14,268 顆星)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

Currently we generate output that ends with .call(this). This works fine in a global context. It would, however, be nice to be able to generate an output that doesn't assume that this is the global context so that it can run inside of a "module" and still be able to reach for the global object. In this context this is something else.

Perhaps we can detect if the global variable is available in the scope and conditionally use that? Otherwise fallback to this? I.e. .call(global || this)

cc @kittens

貢獻者指南