-
-
Notifications
You must be signed in to change notification settings - Fork 22
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
Support resolution with Yarn PnP. #80
Conversation
} catch (e) { | ||
if (e.code === 'MODULE_NOT_FOUND') { | ||
if (ALLOWED_ERROR_CODES.includes(e.code)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should probably use debug or heimdall-logger here to make this easier to debug
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ya, good point. I'll do that in a separate PR then rebase this one...
CI failure is due to not running recent enough yarn version in CI. #81 should fix. |
6a17cbf
to
83cb1c1
Compare
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 `resolve@1.9.0` 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.
@Turbo87 - no, you are right it was a node 6 issue |
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 inresolve@1.9.0
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 thepnpapi
module). If we are, we use the public API provided by Yarn'spnpapi
module to resolve the package being checked for relative to the provided root.Fixes #78.
Related to ember-cli/ember-cli#8164.