Skip to content
This repository was archived by the owner on Aug 4, 2021. It is now read-only.
This repository was archived by the owner on Aug 4, 2021. It is now read-only.

node-resolve doesn't cache lookups #121

@keithamus

Description

@keithamus

If node-resolve has found a non-relative module - i.e. one that exists in side node_modules, it should cache this lookups - to save time doing subsequent re-lookups, to avoid hitting the disk again.

I am discovering this because one of my modules takes 10ms to resolve using node-resolve (node-resolve needs to read the package.json to determine where the module exists), and this module is used 100 times in the codebase, currently it takes a second of cumulative lookups for this module, but it should be able to hit a cache so only the first hit takes 10ms while subsequent hits should only be 1-2ms at worst.

Happy to submit a PR if you feel this is correct 😄

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions