-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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
chore: fix e2e yarn berry tests #5342
Conversation
✔️ [V2] 🔨 Explore the source changes: 8422f9a 🔍 Inspect the deploy log: https://app.netlify.com/sites/docusaurus-2/deploys/61150065e5ade900074f8748 😎 Browse the preview: https://deploy-preview-5342--docusaurus-2.netlify.app |
⚡️ Lighthouse report for the changes in this PR:
Lighthouse ran on https://deploy-preview-5342--docusaurus-2.netlify.app/ |
Size Change: 0 B Total Size: 793 kB ℹ️ View Unchanged
|
@slorber The Maybe we can merge this now or test with canary versions of Yarn. |
yarn set version canary | ||
yarn --version | ||
|
||
yarn config set nodeLinker ${{ matrix.nodeLinker }} | ||
yarn config set pnpMode loose |
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.
yarn config set pnpMode loose |
There are undeclared dependencies that aren't failing the test because of this
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.
Yes I've seen those.
However some are:
- mdx loader (my fault, will fix)
debug
usingsupports-color
(not my fault, how to fix?)- code copied from CRA using Node.js
url
. We'll likely delete this code and move back to using CRA code (which also doesn't declareurl
as dependency btw). Also I'm not totally sure how to fix this. Should I just add npm packageurl
as dependency? How can I know the good version to use considering it's provided by Node.js runtime?
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.
I'd like to fix those but likely in another PR.
The goal here is just to make our existing CI pass again (which was already using loose mode)
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.
debug using supports-color (not my fault, how to fix?)
Nothing to fix, it's an optional peer dependency that isn't provided by the parent so it logs an error but it's fine to ignore and wont be visible in strict mode
code copied from CRA using Node.js url. We'll likely delete this code and move back to using CRA code (which also doesn't declare url as dependency btw). Also I'm not totally sure how to fix this. Should I just add npm package url as dependency? How can I know the good version to use considering it's provided by Node.js runtime?
It's because Webpack 5 doesn't polyfill Node libraries by default, you need to do it yourself
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.
Nothing to fix, it's an optional peer dependency that isn't provided by the parent so it logs an error but it's fine to ignore and wont be visible in strict mode
Thanks
It's because Webpack 5 doesn't polyfill Node libraries by default, you need to do it yourself
I've tried adding alias: {url: 'url'}
in Webpack config but the error was still there. It's not clear to me what I should do exactly and the Medium link you gave in some yarn issue didn't make it very clear either
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.
You're running into https://github.com/webpack/changelog-v5/tree/b9a346f9090bf2e9f8bc96864a88ed07ad7bc1a4#automatic-nodejs-polyfills-removed so aliasing url
to url
makes no difference.
Next.js deals with this by aliasing url
to native-url
https://github.com/vercel/next.js/blob/681d298bdf7048bdbd2790a551d5d231906ede6f/packages/next/build/webpack-config.ts#L125
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.
I see thanks, will try that.
For the mdx-loader
issue, unfortunately I can't just add it because it would create a cycle in Lerna build:
lerna WARN ECYCLE @docusaurus/mdx-loader -> @docusaurus/core -> @docusaurus/mdx-loader
I see how I could re-org the code to avoid this cycle but was wondering if there's a way to just tell Yarn that the dependency is here without having to declare it in any deps? peerDependency
works but is annoying because all site's parent lockfile would now have to declare @docusaurus/mdx-loader
, while we know for sure it is here.
Co-authored-by: Kristoffer K. <merceyz@users.noreply.github.com>
Thanks all, finally fixing this annoying issue! We'll revert to a stable release, and try to disable loose mode in the future. As Yarn 3 is out, I don't feel like we need to have tests for Yarn 2 anymore, probably not worth it to add more 2 more CI jobs, we already have a lot |
# temporary using canary for #5342 | ||
yarn set version canary |
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.
We've released 3.0.1 with the fix so this can be reverted
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.
ohhh too late :D
anyway I don't mind staying on canary for now, I could report issues we have with it that do not happen in stable releases
Motivation
The Yarn 2 CI is failing for a while now and it's quite difficult to debug those Yarn 2/3 PnP-only issues.
For now, I'm reverting to node-modules linking, but would be happy to add another test with PnP mode if anyone is able to make it work.
CC @SamChou19815 in case you are interested to troubleshoot the issue. I was not able to do so (#5340).
Repro steps:
Apart a few deps error, the main error is:
Unfortunately can't figure out where this comes from, and the PnP zip files do not help debug this problem.
Have you read the Contributing Guidelines on pull requests?
yes
Test Plan
ci