Open
Description
In Node, a common idiom for checking if the current module is the one that was directly invoked is if (require.main === module) { ... }
. Here are the docs.
This works as expected when the module is "inlined" in the top-level IIFE of the generated JavaScript code (see my other issue), but when this code is used inside of a define
d module this condition fails because require
is not the expected object.
This seems to be caused by require
being provided by dependency injection, because the injected require
object is a function rather than its usual object value.
Metadata
Metadata
Assignees
Labels
No labels