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
As a result of nodejs/node#32217, module.parent is deprecated (DEP0144), at least in part because it is not set for a CJS module imported using the ESM loader. The deprecation causes parent-require to print a warning if node is run with --pending-deprecation (or throw if run with --throw-deprecation):
node --pending-deprecation -e "require('parent-require')('parent-require')"
(node:483687) [DEP0144] DeprecationWarning: module.parent is deprecated due to accuracy issues. Please use require.main to find program entry point instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
The suggestion in the DEP0144 docs is to use require.cache with module.children to find parents:
Unfortunately, I don't think this would work with the ESM loader, which does not use require.cache. I'm not sure there is a way to support the ESM loader, but I thought it was worth opening this issue so that you are aware.
Thanks,
Kevin
The text was updated successfully, but these errors were encountered:
As a result of nodejs/node#32217,
module.parent
is deprecated (DEP0144), at least in part because it is not set for a CJS module imported using the ESM loader. The deprecation causesparent-require
to print a warning if node is run with--pending-deprecation
(or throw if run with--throw-deprecation
):The suggestion in the DEP0144 docs is to use
require.cache
withmodule.children
to find parents:Unfortunately, I don't think this would work with the ESM loader, which does not use
require.cache
. I'm not sure there is a way to support the ESM loader, but I thought it was worth opening this issue so that you are aware.Thanks,
Kevin
The text was updated successfully, but these errors were encountered: