New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Yarn Berry: Switch from from node_modules to PnP #161
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/kachkaev/njt/7qTQ5QxYp6S39Db3nrMUhvBTvmFG |
You can add https://github.com/microsoft/rushstack/tree/9c81203c95dcfab1631e9fd12913c7a3681d7360/stack/eslint-patch to your ESLint config to fix their resolution instead |
This reverts commit d331ba5.
styled-components@*: | ||
dependencies: | ||
react-is: "*" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eslint-module-utils@*: | ||
dependencies: | ||
eslint-import-resolver-node: "*" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, thanks for your tip @merceyz! Adding If you have any other tips, please fell free to share! 🙌 |
I see you're using Vercel! What are things we could do to support PnP better on our platform, if any? Thanks in advance. |
👋 @rauchg! Unfortunately Vercel does not currently support Yarn PnP. Here are some links I could dig out while working on this PR:
As a workaround proposed in vercel/vercel#5280 (comment), I had to set I hope PnP will get some priority this year because Yarn installs are significantly faster without Looking at the state of my experiment (this PR), I’m somewhat sure that PnP will start setting off in 2022. Tooling support was way worse a year ago when I started, but it’s pretty much there now! |
Mission complete! 🕺 |
Continues #160, replaces #29
Key steps:
Edit
.yarnrc.yml
:Run
rm -rf node_modules rm -rf cli/node_modules ## specific to this project
Update
.gitignore
and other*ignore
files:It might be worth keeping
node_modules
for some time if you expect to switch between PnP and non-PnP branches.Run
Remove
nodeLinker: pnp
from.yarnrc.yml
(doing this in step 1 breaksyarn install
in step 2).Add
require("@rushstack/eslint-patch/modern-module-resolution");
andparserOptions: { tsconfigRootDir: __dirname },
to.eslintrc.js
– see https://www.npmjs.com/package/@rushstack/eslint-patch. Thanks to @merceyz for the tip!Track Picking a different typescript.tsdk from a list / use in a multi-root workspace with yarn2 pnp microsoft/vscode#108866 and don’t use multi-root workspaces in VSCode until resolved
Track yarn2 Vercel build failed - No Next.js version could be detected in your project vercel/vercel#5280 for a permanent fix of Next.js deployment to Vercel
From Vercel’s knowledge base: https://vercel.com/knowledge/does-vercel-support-yarn-2
Case study: [Case Study] Vercel+nextjs PnP compatibility yarnpkg/berry#2031
Workaround: Add
FORCE_BUILDER_TAG=canary
in Vercel dashboard