Skip to content

Really inefficient resolution #116

@steelbrain

Description

@steelbrain

Suppose we are in /a/b/c/d.js and require some-thing and node_modules is in /a/node_modules, node-resolve handles this extremely efficiently

Current behavior:

Checks these in order to see which one exists

  • /a/b/c/node_modules/some-thing.js
  • /a/b/c/node_modules/some-thing/node_modules/package.json
  • /a/b/node_modules/some-thing.js
  • /a/b/node_modules/some-thing/node_modules/package.json
  • /a/b/c/node_modules/some-thing.js
  • /a/b/c/node_modules/some-thing/node_modules/package.json
  • /a/node_modules/some-thing.js
  • /a/node_modules/some-thing/node_modules/package.json

It gets even more inefficient as the number of possible extension grows, it does some many stats that for our module bundler bundling our app it can easily get to a hundred thousand unnecessary stats

The ideal behavior would be

  • /a/b/c/node_modules
  • /a/b/node_modules
  • /a/node_modules
  • /a/node_modules/some-thing.js
  • /a/node_modules/some-thing/node_modules/package.json

I'm on [email protected] at the time of writing

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