Skip to content

Backport Yarn PnP Support to 2.x - #83

Merged
rwjblue merged 7 commits into
v2from
backport-yarn-pnp-support
Jan 7, 2019
Merged

rwjblue merged 7 commits into
v2from
backport-yarn-pnp-support

Conversation

@rwjblue

@rwjblue rwjblue commented Jan 7, 2019

Copy link
Copy Markdown
Member

No description provided.

Robert Jackson added 5 commits January 7, 2019 11:33
Yarn 1.12.x supports the new PnP system to allow folks to avoid having a
`node_modules/` folder in _each_ project. To implement this, they create
a static file mapping table for each package and then require them
directly from the global Yarn cache.

Since a PnP project is no longer following the "normal" node module
resolution rules changes were needed in the `resolve` package. Those
changes landed in `[email protected]` and are leveraged by Yarn 1.13.0+.

In the mean time (throughout the Yarn 1.12.x lifespan), a simple
`resolve.sync` isn't quite good enough so we now detect if we are
running in a PnP scenario (by attempting to require the `pnpapi`
module). If we are, we use the public API provided by Yarn's `pnpapi`
module to resolve the package being checked for relative to the provided
root.

(cherry picked from commit 83cb1c1)
(cherry picked from commit fcb489f)
@rwjblue
rwjblue requested a review from Turbo87 January 7, 2019 16:40
@rwjblue
rwjblue merged commit e717042 into v2 Jan 7, 2019
@rwjblue
rwjblue deleted the backport-yarn-pnp-support branch January 7, 2019 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants