Skip to content

Use the real path for resolving dependencies #130

Closed

Description

@zkochan

Node uses the real path of modules (except when executed with --preserve-symlinks) to resolve dependencies. That is why pnpm's symlinked node_modules work fine with Node applications.

However, resolve is a really popular and widely used package and it does not use the real path of modules to resolve dependencies. As a consequence, a lot of tooling fails with pnpm. See the most recent issue: pnpm/pnpm#857. And also many of these might be related: pnpm/pnpm#801

Would you accept a pull request to change the behavior of resolve to work the way Node does? It won't change anything for projects that use npm/Yarn because they don't leverage symlinks but it would be a huge help for the pnpm community!

Activity

  1. ljharb commented on Jul 24, 2017

    @ljharb
    Member

    Sure, that sounds good - let's ensure that a) existing tests keep passing (ofc), b) we add a "preserve symlinks" option, so users can control the behavior if they like, and c) let's think carefully about if it's possible to avoid a semver-major.

  2. added 2 commits that reference this issue on Jul 25, 2017
    c95b20e
    0fa967f
  3. added a commit that references this issue on Jul 26, 2017
    de63230
  4. added 2 commits that reference this issue on Jul 26, 2017
    771468e
    3cd8620
  5. added a commit that references this issue on Jul 26, 2017
    fed3f0f
  6. added a commit that references this issue on Jul 26, 2017
  7. malash commented on Nov 26, 2018

    @malash

    @zkochan Did you forget to change this condition when resolving real path for basedir ?

    var res = path.resolve(y, x);

    E.g. this line may fail require('resolve').sync('../../path/to/another/package', { basedir: '/path/to/a/symlink' }).

    FYI @ljharb

  8. ljharb commented on Nov 26, 2018

    @ljharb
    Member

    @malash could you file a separate issue for that, with a test case?

  9. malash commented on Nov 27, 2018

    @malash

    I'v create a new issue with bad case example #177

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions