Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(pnp): use exports implementation from Node.js #5331

Merged
merged 8 commits into from
Mar 27, 2023

Conversation

merceyz
Copy link
Member

@merceyz merceyz commented Mar 19, 2023

What's the problem this PR addresses?

The way @yarnpkg/pnp handles the exports field doesn't match Node.js.

Fixes #3740
Fixes #4803

How did you fix it?

Replace resolve.exports with the implementation from Node.js.

Checklist

  • I have read the Contributing Guide.
  • I have set the packages that need to be released for my changes to be effective.
  • I will check that all automated PR checks pass before the PR gets reviewed.

@arcanis
Copy link
Member

arcanis commented Mar 23, 2023

cc @GeoffreyBooth - that's the kind of thing where Node.js helpers would be very valuable

@GeoffreyBooth
Copy link

cc @GeoffreyBooth - that's the kind of thing where Node.js helpers would be very valuable

Pull requests are welcome!

Comment on lines +1 to +4
releases:
"@yarnpkg/cli": patch
"@yarnpkg/plugin-pnp": patch
"@yarnpkg/pnp": patch
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a risk in shipping it as a patch? Entirely changing the implementation may cause a couple of behaviours that people rely on to change.

Copy link
Member Author

@merceyz merceyz Mar 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is a breaking change but PRs making PnP match the Node.js behaviour usually aren't marked as such even though all of them are breaking changes.

Our current implementation doesn't match any version of Node.js while this new version doesn't match versions before v18, the former seems worse.

https://xkcd.com/1172 comes to mind.

@arcanis arcanis merged commit f3115b4 into master Mar 27, 2023
@arcanis arcanis deleted the merceyz/fix/pnp-exports branch March 27, 2023 11:01
merceyz added a commit that referenced this pull request Mar 29, 2023
* fix(pnp): use exports implementation from node

* test: remove test for removed feature

* test: fix paths

* chore: remove `resolve.exports`

* test: error codes

* chore: build

* chore: versions

* chore: lint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants