question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[yarn pnp] Dep optimizer does not work with virtual path (peer-dependencies)

See original GitHub issue

⚠️ IMPORTANT ⚠️ Please check the following list before proceeding. If you ignore this issue template, your issue will be directly closed.

  • Read the docs.
  • Use Vite >=2.0. (1.x is no longer supported)
  • If the issue is related to 1.x -> 2.0 upgrade, read the Migration Guide first.

Describe the bug

When using peer dependencies Yarn is creating virtual paths, when vite optimize deps it keeps the file structure: Screen Shot 2021-01-27 at 10 08 14 AM Now yarn here is modifying the behaviour of native existsSync and return false despite the folder exists in the cache. This condition fails and does not preprend the FS_PREFIX to the path resulting in a 404 https://github.com/vitejs/vite/blob/2950c3c278e20174184e44c194393b098c0d4305/packages/vite/src/node/plugins/importAnalysis.ts#L184

Sorry for submitting another issue related to yarn2, I understand that moving forward you don’t want to invest more energy in supporting it. We are considering other solutions

Maybe @merceyz or @arcanis can chime in here ?

Reproduction

https://github.com/AlexandreBonaventure/vite-yarn-optimize-virtual

System Info

  • vite version: 2.0.0-beta.50
  • Operating System: Mac OS
  • Node version: 14
  • Package manager (npm/yarn/pnpm) and version: yarn 2

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
yyx990803commented, Jan 28, 2021

The PR does help because esbuild’s output path behavior has been a source of bugs. I think I can refactor it to generate the file structure that I want with the technique used in your PR…

2reactions
AlexandreBonaventurecommented, Jan 28, 2021

yes preparing a PR

Read more comments on GitHub >

github_iconTop Results From Across the Web

Support optional peerDependencies #6487 - yarnpkg/yarn
To have a (backwards-compatible) way to declare a peer dependency as optional, which would allow the PnP resolver to still work, but if...
Read more >
Plug'n'Play | Yarn - Package Manager
An overview of Plug'n'Play, a powerful and innovative installation strategy for Node.
Read more >
npm v7 Series - Why Keep `package-lock.json`?
The simple answer is: because yarn.lock doesn't fully address npm's ... as it's an unlisted dep) does require("baz") , the result would not ......
Read more >
How to handle peer dependencies when developing modules
The problem with peer dependencies is npm and yarn don't install them at all. This is the right behavior for production purpose but...
Read more >
v2 Addon Format (Embroider Compatibility) - Ember RFCs
Another way to state the problem is that apps and addons all push whatever ... the node_modules algorithm, but it could also mean...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found