feat: add warning to discourage Vite with yarn pnp#21906
Conversation
|
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. |
@vitejs/plugin-legacy
vite
commit: |
|
I propose we take a plugin approach if this is feasible? e.g. |
|
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 |
|
There is somewhat support for PnP in Rolldown: rolldown/rolldown#5147 But with the issues here: #21875 and in rolldown: #21875, what is the bundler ecosystem at play is here? If support of PnP is not something the teams want to manage, then would it been better to migrate existing support to a external project/plugin (e.g. rolldown) over a warning? |
|
You can suppress the warning by using the Just in case, this PR won't block you from creating a plugin that supports yarn pnp. That plugin can also suppress the warning internally. That said, we cannot provide a dedicated API to hook into the internals of Vite for that plugin as that would be the same with maintaining the dedicated code path. |
|
That's sad indeed. No shame on maintainer team, I totally understand the burden. But JS ecosystem is built on belief that everything's unlimited: bandwidth, disk space, I/O, and sometimes CPU. Since the goal of Vite is speed by efficiency (and thanks a LOT for rolldown), supporting PnP should be a main target: it just avoid wasting 600MB for nothing on each CI job. |
|
@Glandos FYI |
|
Here is the code to put in const logger = createLogger()
const loggerWarnOnce = logger.warnOnce
logger.warnOnce = (msg, options) => {
if (msg.includes('Using Yarn PnP with Vite is discouraged and PnP-specific bugs will no longer be actively worked on.')) {
return
}
loggerWarnOnce(msg, options)
}
export default defineConfig({
customLogger: logger,
} |
Adding the following message to discourage people from using yarn pnp with Vite:
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 settingnodeLinker: node-modulesin 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.