berry icon indicating copy to clipboard operation
berry copied to clipboard

[Bug?]: Handling of package.json#exports is not working correctly with intermediate wildcard.

Open gpickell opened this issue 3 years ago • 1 comments

Self-service

  • [ ] I'd be willing to implement a fix

Describe the bug

When using yarn with pnp linking, the handling of the * in a package.json#exports has a compatibility issue. Mainly, if the * appears in the middle, it fails, but this is supported with node out-of-the-box.

package.json:

  ...

  "exports": {
    "./*/index": "./src/*.mjs", // not honored when linking pnp-style but works otherwise
    "./*": "./src/*.mjs" // works always
  }

  ...

To reproduce

See: https://github.com/gpickell/yarn-bug-exports-handling

yarn
yarn test # works
# remove nodeLinker line from .yarnrc.yml
yarn
yarn test # fails

Environment

System:
    OS: Windows 10 10.0.22000
    CPU: (16) x64 AMD Ryzen 7 5800X 8-Core Processor
  Binaries:
    Node: 16.16.0 - ~\AppData\Local\Temp\xfs-a40a0340\node.CMD
    Yarn: 3.2.3 - ~\AppData\Local\Temp\xfs-a40a0340\yarn.CMD
    npm: 8.11.0 - ~\AppData\Local\nvs\node\16.16.0\x64\npm.CMD

Additional context

No response

gpickell avatar Aug 30 '22 16:08 gpickell

The exports support is provided by https://github.com/lukeed/resolve.exports, a bug should be open there

arcanis avatar Sep 03 '22 16:09 arcanis

I am issuing a pull request to resolve.exports --- more eyes would be appreciated. See: https://github.com/lukeed/resolve.exports/pull/21

gpickell avatar Sep 26 '22 06:09 gpickell

Hi! 👋

This issue looks stale, and doesn't feature the reproducible label - which implies that you didn't provide a working reproduction using Sherlock. As a result, it'll be closed in a few days unless a maintainer explicitly vouches for it or you edit your first post to include a formal reproduction (you can use the playground for that).

Note that we require Sherlock reproductions for long-lived issues (rather than standalone git repositories or similar) because we're a small team. Sherlock gives us the ability to check which bugs are still affecting the master branch at any given point, and decreases the amount of code we need to run on our own machines (thus leading to faster bug resolutions). It helps us help you! 😃

If you absolutely cannot reproduce a bug on Sherlock (for example because it's a Windows-only issue), a maintainer will have to manually add the upholded label. Thanks for helping us triaging our repository! 🌟

yarnbot avatar Oct 26 '22 07:10 yarnbot

I think the resolve.exports project might be a little on the "inactive side".

gpickell avatar Dec 04 '22 20:12 gpickell

Indeed, I have a branch that fixes the issue but haven't had the time to complete it yet.

merceyz avatar Dec 04 '22 21:12 merceyz

I believe resolve.exports project has been updated to fix this issue. The pull request is no longer relevant.

gpickell avatar Jan 18 '23 19:01 gpickell