-
-
Notifications
You must be signed in to change notification settings - Fork 473
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
Cannot resolve debug
on yarn 2.x.x
#851
Comments
debug
on yarn 2.x.xdebug
on yarn 2.x.x
Hey, @grapgrap. Thanks for reporting this. Something seems to be off, but I don't have enough info to say on whose side it is.
MSW doesn't depend on |
I can also recommend raising an issue in the Yarn's repo to see what their maintainers can recommend. At the first glance, I don't see what may be wrong with how we specify the dependencies. The fact that this is only reproduced on |
It does actually import it directly https://cdn.jsdelivr.net/npm/msw@0.33.3/lib/esm/index.js, most likely caused by Line 37 in cd53d6f
Nope, Yarn PnP is just really strict about undeclared dependencies |
That import is correct: the I believe that specifying it as an external dependency is the primary use-case for I'm open to refactoring this. |
Yeah that's fine, but it means |
That sounds unapparent to me. The This sounds like the |
Thanks for your comments. If It will help me to understand the misunderstandings caused by my poor English.
|
If |
I understand your comments.
And I searched the string, The code use in this file on I think this part is the cause that try to import ps. Sorry for the slow reply. |
No worries, @grapgrap. Your debugging is correct: the
Here are the summarized statements:
Once again, in a proper world, It may feel natural to list |
No matter how the import ends up in the code, the fact is that it's there and needs to be declared as a dependency, please read the docs I linked to in #851 (comment)
Lets say it does drop it and |
What I think is the solution here is to figure out how to properly bundle |
They will not get that error with the current setup. If the @merceyz, my statement above still stands: I don't think this is a dependency specification issue. It's a bundling issue. If the |
If you remove (or replace the logical fork) |
I've opened an issue (debug-js/debug#836) in |
@kettanaito Thanks you! I follow the issue 👍 |
While we were discussing this, I've noticed that the Historically, I recall there was an issue when building interceptors, which caused some of them to fail in certain environments (don't remember the exact context). Introducing a build step should be done with caution. |
Most of this packages dependencies are bundled into the build lib/ folder using rollup and thus don't actually need to be dependencies, but rather should be devDependencies IMO. |
You've raised a valid point, @patrickmcdougle-okta, that some of the dependencies should be treated as external. That'd help with bug-fixes propagation and make the dependency tree more transparent. As for the other dependencies, I believe some must be bundled. It'd be nice to review the entire dependency tree and decide the pain points to fix. Contributions are always welcome! |
Digging further at this, we shouldn't externalize debug in the build if we also don't mark it as a dependency. We're effectively telling the system "don't bundle debug please, because I promise it will exist at run time" but then we don't enforce that it exists at runtime through a dependency. We can't have it both ways, either we bundle debug OR list it as a dependency. Right now we're not doing either. |
Describe the bug
Yarn cannot resolve 'debug' of
msw
Environment
msw: 0.29.0
nodejs: 14.16.1
npm: 6.14.12
yarn: 2.4.2
webpack: 5.24.3
To Reproduce
Steps to reproduce the behavior:
msw@0.29.0
above.yarn@2.x.x
aboveExpected behavior
When i tried with
msw@0.28.2
andyarn@1.x.x
each, It was ok.I think module resolver cannot resolve pnp module that
debug
ofmsw
external.Additional Information
I tried to install
debug
and config it to peer dependency on.yarnrc.yml
.And then it works.
I did not use
rollup
well. I thinkmsw
should havedebug
to peer dependency.The text was updated successfully, but these errors were encountered: