[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: 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:
- Created 3 years ago
- Comments:11 (8 by maintainers)
Top GitHub Comments
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…
yes preparing a PR