Skip to content

Conversation

paul-soporan
Copy link
Member

What's the problem this PR addresses?

When using PnP, calling require.resolve('pnpapi') tries to apply the exports resolution on the pnpapi path, either remapping it if there's a ".pnp.cjs": "./whatever.js" export (which is wrong) or throwing if there isn't such an export.

We originally considered this in #2431 (comment) but thought it wasn't a problem, even though it actually is - the unqualifiedPath is the one that gets resolved to a path in resolveUnqualifiedExport, not the request.

Fixes #3493.

How did you fix it?

Special-cased pnpapi in resolveRequest with an early return.

Checklist

  • 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 arcanis merged commit 2e04683 into master Sep 29, 2021
@arcanis arcanis deleted the paul/fix/exports-pnpapi branch September 29, 2021 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants