Cannot resolve `debug` on yarn 2.x.x
See original GitHub issueDescribe the bug
Yarn cannot resolve ‘debug’ of msw
✖ 「wdm」: ERROR in ../../.yarn/unplugged/msw-npm-0.33.3-7287fb2021/node_modules/msw/lib/esm/index.js 10:0-31
Module not found: Error: Can't resolve 'debug' in '/Users/a202006041/workspace/toolbox/.yarn/unplugged/msw-npm-0.33.3-7287fb2021/node_modules/msw/lib/esm'
@ ./src/mock/worker.ts 4:0-40 5:12-21 9:20-37
@ ./src/mock/index.ts 38:19-37
@ ./src/index.tsx 10:0-41 12:0-15
Environment
msw: 0.29.0
nodejs: 14.16.1
npm: 6.14.12
yarn: 2.4.2
webpack: 5.24.3
Please also provide your browser version.
To Reproduce
Steps to reproduce the behavior:
- Install
msw@0.29.0
above. - Run msw using webpack on
yarn@2.x.x
above
Expected behavior
When i tried with msw@0.28.2
and yarn@1.x.x
each, It was ok.
I think module resolver cannot resolve pnp module that debug
of msw
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 think msw
should have debug
to peer dependency.
// package.json
{
...
devDependencies: {
...
"debug": "^4.3.2",
"msw": "^0.33.3",
}
...
}
// .yarnrc.yml
packageExtensions:
'msw@*':
peerDependencies:
'debug': '*'
Issue Analytics
- State:
- Created 2 years ago
- Comments:20 (13 by maintainers)
Top Results From Across the Web
Developers - Cannot resolve `debug` on yarn 2.x.x -
Steps to reproduce the behavior: 1. Install msw@0.29.0 above. ... Expected behavior. When i tried with msw@0.28.2 and yarn@1.x.x each, It was ok....
Read more >Error Codes | Yarn - Package Manager
A list of Yarn's error codes with detailed explanations. ... A dependency uses a workspace: range that cannot be resolved to an existing...
Read more >Issues
I'm using version 0.17.3. If I run npm install everything works fine. The problem only shows up when I do yarn install.
Read more >Howto fix yarn error when installing local package?
After running yarn I see a folder node_modules/@theia/cpp-debug. ... src-gen/frontend/index.js Module not found: Error: Can't resolve ...
Read more >npm, pnpm, and Yarn | IntelliJ IDEA Documentation
Make sure you have Yarn 1 installed globally and enable Yarn 2 in your project as described on the Yarn official website. Use...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.