Skip to content

ESM Hooks: nextResolve & nextLoad can return promises which is not reflected in documentation #49282

Description

@koshic

Affected URL(s)

https://nodejs.org/dist/latest-v20.x/docs/api/esm.html#hooks

Description of the problem

image

But in the reality nextResolve (and nextLoad) can return Promises, which is highly confusing: as an example, try...catch around 'return nextResolve(...)' will never catch the error if nextResolve returns rejected Promise. The same thing with access to nextResolve(...) result properties.

In both cases await keyword is mandatory to get predictable results.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docIssues and PRs related to Node.js documentation.esmIssues and PRs related to the ECMAScript Modules implementation.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions