-
Notifications
You must be signed in to change notification settings - Fork 73
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
Oclif can't find plugins when using yarn pnp/yarn 4 #806
Comments
@danieltroger Thanks for creating the issue and doing so much investigative work on it! Would it be possible to create a repository that has all the items you included in the |
@mdonnalley sorry for the late response. I tried following the reproduction steps that I wrote and ended up with a quite different setup than what we're running in production, but the oclif bug is still reproducible. I set it up for yarn 4 but if you go down to yarn 3 the same issue happens. To reproduce:
You should see this output
|
This issue has been linked to a new work item: W-14331357 |
Describe the bug
I couldn't migrate my shopify app to yarn 3/4 due to shopify using oclif which can't resolve packages correctly when using yarn pnp.
The issue is that
@shopify/app
doesn't have.
in it's package.json#exports field and thereforerequire.resolve
can't be used to find the package path (oclif tries to find@shopify/app
's package.json). And oclif's alternative resolution methods fail due to yarn pnp's way of loading packages (I presume).A way of fixing it is to use the pnpapi when available to resolve the package location like my patch provided below.
To Reproduce
I already spent too much time on this so haven't tested the reproduction steps, LMK if you need more info here.
Steps to reproduce the behavior:
npm init @shopify/app@latest
package-lock.json
node_modules
touch yarn.lock
yarn set version canary
.yarnrc.yml
withnodeLinker: "pnp"
inside to force yarn to use pnp (I need pnp because yarn glitches with my link setup without it)yarn install
shopify app dev
command app:dev not found
, this is due to@shopify/cli
not being able to load@shopify/app
as oclif plugin due to the resolving issue detailed aboveExpected behavior
oclif correctly resolves the plugins -> Shopify devs my app as usual
Screenshots
If applicable, add screenshots to help explain your problem.
Plugins get requested:
The plugins failed to set up:
require.resolve failing
My patch that works (probably very hacky)
Something like this is what you'd need to change. I'm applying this with
yarn patch
and now things work for me :) The biggest issue with the patch in its current state, if you were to merge it:Environment (please complete the following information):
Additional context
cc some random shopify cli maintainer that I saw responding to issues while solving this: @alvaro-shopify
related: #309 and oclif/config#289 (comment)
The text was updated successfully, but these errors were encountered: