facebookarchive/prepack

Generate CommonJS Module Compatible Output

Open

#451 aperta il 25 apr 2017

Vedi su GitHub
 (2 commenti) (0 reazioni) (0 assegnatari)JavaScript (520 fork)batch import
enhancementhelp wanted

Metriche repository

Star
 (14.268 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

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

Guida contributor