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): check if path belongs to a pnpapi instance before checking the filesystem #2068

Merged
merged 5 commits into from
Nov 4, 2020

Conversation

merceyz
Copy link
Member

@merceyz merceyz commented Oct 30, 2020

What's the problem this PR addresses?

  • Using the portal: protocol to an external project could end up using that projects pnpapi, which if the project has peer dependencies, would cause MODULE_NOT_FOUND errors if the pnpapi context was lost and had to be located.
  • Using the global cache (enableGlobalCache: true) is fragile and does not handle loosing the pnpapi context while in the global cache

Fixes #706
Fixes #965
Fixes standard-things/esm#871 (cc @jonaskuske)

How did you fix it?

Ask each pnpapi instance if they control the modulePath, if more than one pnpapi controls the path throw an error, if only one controls it use that instance, otherwise fallback to searching the filesystem.

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.

@merceyz merceyz force-pushed the merceyz/pnpapi-portal branch from 8c77ed2 to c413500 Compare October 31, 2020 20:36
@merceyz merceyz force-pushed the merceyz/pnpapi-portal branch from c413500 to e5a914f Compare November 1, 2020 13:13
@merceyz merceyz marked this pull request as ready for review November 1, 2020 13:13
@arcanis arcanis merged commit 2f8f33e into master Nov 4, 2020
@arcanis arcanis deleted the merceyz/pnpapi-portal branch November 4, 2020 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants