Skip to content

feat: add warning to discourage Vite with yarn pnp#21906

Open
sapphi-red wants to merge 1 commit intovitejs:mainfrom
sapphi-red:feat/discorage-yarn-pnp
Open

feat: add warning to discourage Vite with yarn pnp#21906
sapphi-red wants to merge 1 commit intovitejs:mainfrom
sapphi-red:feat/discorage-yarn-pnp

Conversation

@sapphi-red
Copy link
Member

@sapphi-red sapphi-red commented Mar 17, 2026

Adding the following message to discourage people from using yarn pnp with Vite:

Using Yarn PnP with Vite is discouraged and PnP-specific bugs will no longer be actively worked on.
Please switch to a different 'nodeLinker' mode or to a different package manager.

While yarn defaults to yarn pnp when running yarn set version stable, maintaining a dedicated code path to support it has been a consistent maintenance overhead for the Vite team. Given that users can easily opt out of PnP by setting nodeLinker: node-modules in their .yarnrc.yml, I think it is the right call to discourage its use and allocate time on the other areas.

If someone is willing to maintain the yarn pnp support in Vite including all the upstream dependencies and also fixes, #15809, we can remove this warning.

@sapphi-red sapphi-red added this to the 8.1 milestone Mar 17, 2026
@sapphi-red sapphi-red added the p2-nice-to-have Not breaking anything but nice to have (priority) label Mar 17, 2026
@github-project-automation github-project-automation bot moved this to Discussing in Team Board Mar 17, 2026
@sapphi-red sapphi-red changed the title feat: add warning to discorage yarn pnp feat: add warning to discourage Vite with yarn pnp Mar 17, 2026
@sapphi-red sapphi-red moved this from Discussing to Approved in Team Board Mar 18, 2026
@wojtekmaj
Copy link

wojtekmaj commented Mar 18, 2026

That's understandable but very disappointing. Yarn PnP may not provide the best DX for development, but allows to speed up CI jobs dramatically by avoiding unnecessary I/O (I've seen 20+ seconds saved on each job just by turning on PnP!) and is the easiest way to catch bugs in declared dependencies.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 19, 2026

Open in StackBlitz

@vitejs/plugin-legacy

pnpm add https://pkg.pr.new/@vitejs/plugin-legacy@21906 -D
npm i https://pkg.pr.new/@vitejs/plugin-legacy@21906 -D
yarn add https://pkg.pr.new/@vitejs/plugin-legacy@21906.tgz -D

vite

pnpm add https://pkg.pr.new/vite@21906 -D
npm i https://pkg.pr.new/vite@21906 -D
yarn add https://pkg.pr.new/vite@21906.tgz -D

commit: 833b407

@sapphi-red sapphi-red marked this pull request as ready for review March 19, 2026 04:52
@psychobolt
Copy link
Contributor

I propose we take a plugin approach if this is feasible? e.g. vite-plugin-pnp ?

@mrginglymus
Copy link
Contributor

Please consider adding a flag to make this warning skippable. I already have an unskippable warning from storybook telling me to stop using Yarn PnP.

As the author of the linked bug (and many others in vite, vitest and storybook relating to pnp support) I'm more than willing to take the risk locally of using PnP, so these warnings are quite annoying noise.

In terms of supporting yarn in vite, I've found that a very trivial plugin to intercept vite:resolve has fixed almost all the compatibility issues I've had personally, and I'd be happy to try and turn that into a published package. I did ask a while back about the possibility of making the vite:resolve plugin a bit more hookable, as currently monkey-patching core plugins is a bit of a pain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

p2-nice-to-have Not breaking anything but nice to have (priority) trigger: preview

Projects

Status: Approved

Development

Successfully merging this pull request may close these issues.

6 participants