Skip to content

Implement async dependency resolution #9505

Closed
@SimenB

Description

Similar to #9504, but for dependency resolution. Like there, this wouldn't be used by Jest just yet, but could (and would, if support is implemented) be used by the ESM support. This logic is implemented in jest-resolve.

I wonder if it makes sense to reintroduce resolve as a dependency since this already has an async code path. That is callback based, but just promisifying that should work fine. But the increased complexity of mjs, cjs etc makes me want to depend on a dedicated module rather than have that complexity live in Jest itself - Jest should just manipulate resolution based on moduleNameMapper etc and possibly cache some stuff on our side.

resolve was actually removed in #4315, via #2925. Some of #2925 reasoning was that resolve was somewhat unmaintained and that we didn't need the async parts of it - neither of which are true anymore.

Added in #9520

import.meta.resolve has landed on node master (nodejs/node#31032, albeit currently behind a flag), so we'll need to implement this regardless of whether we'd want to use it ourselves or not

Activity

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

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions