You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 2, 2023. It is now read-only.
Some packages use a check on
module.parentto know if they are launched from CLI or required by another module:This works fine if you use
require(I tried from both CJS and ES modules):However, when importing from ESM, that doesn't work:
Same for dynamic imports:
I can see three ways to tackle this issue, but none is very satisfying to me:
module.parenttruthy when a CJS is imported (although I have no idea what it could look like).module.parent? Packages usingrequire.main===moduleare fine, so that's what library authors should be using to test this, right?module.createRequireto workaround the issue.