Skip to content
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

fix: add yarn v2 pnp support to default webpack processor #17335

Merged
merged 10 commits into from
Jul 21, 2021

Conversation

missing1984
Copy link
Contributor

@missing1984 missing1984 commented Jul 14, 2021

User facing changelog

Add Yarn v2 pnp support to our default webpack processor.

Additional details

This MR addressed couple issues around yarn v2 pnp support.

How has the user experience changed?

Once this merged, Yarn v2 pnp should work with Cypress out of the box

PR Tasks

  • Have tests been added/updated?
  • Has the original issue or this PR been tagged with a release in ZenHub?
  • Has a PR for user-facing changes been opened in cypress-documentation?
  • Have API changes been updated in the type definitions?
  • Have new configuration options been added to the cypress.schema.json?

@missing1984 missing1984 requested a review from a team as a code owner July 14, 2021 18:40
@missing1984 missing1984 requested review from flotwig and jennifer-shehane and removed request for a team July 14, 2021 18:40
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Jul 14, 2021

Thanks for taking the time to open a PR!

@missing1984
Copy link
Contributor Author

hmm, looks like the failing CI is caused by network issue?

yarn run v1.22.10
$ node ../../scripts/run-ct-examples.js --examplesList=./examples.env
Running tests in /root/cypress/npm/vue
Running yarn install in project /root/cypress/npm/vue
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...

Can someone help to retry the job?

@missing1984
Copy link
Contributor Author

@jennifer-shehane @flotwig since you're marked as reviewers.... anything else i can do to get this merge?

@flotwig
Copy link
Contributor

flotwig commented Jul 19, 2021

@jennifer-shehane @flotwig since you're marked as reviewers.... anything else i can do to get this merge?

Nothing right now. We are working on getting 8.0 out the door right now, but this is a priority for me to get reviewed after 8.0 is out.

@kubijo
Copy link

kubijo commented Jul 20, 2021

Is there anything I can do locally to make the pnp API work until this gets released? Id like to try 8.0, but this blocks me

flotwig
flotwig previously approved these changes Jul 20, 2021
Copy link
Contributor

@flotwig flotwig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There're 2 ways to make Cypress support yarn v2 natively (and close #8008)

1. Switch to use webpack5 from default webpack preprocessor which has built-in pnp support.

2. Add `pnp-webpack-plugin` to our `@cypress/webpack-batteries-included-preprocessor` once [Fix #32 try to use findPnpApi to locate pnpapi arcanis/pnp-webpack-plugin#37](https://github.com/arcanis/pnp-webpack-plugin/pull/37)

I can follow up on option 2

Upgrading the preprocessor to Webpack 5 would be a better solution long-term, but it would have to wait until Cypress 9 since it would be a breaking change. If you want to proceed with #2, that would be a good change to pull in for now that would be non-breaking.

Other than that, tested manually with a local yarn v2 project and yarn node now seems to properly set up NODE_OPTIONS for the plugins process again.

@missing1984
Copy link
Contributor Author

Thanks. ping @arcanis any chance we can get arcanis/pnp-webpack-plugin#37 merged?

@missing1984
Copy link
Contributor Author

Thanks @arcanis, arcanis/pnp-webpack-plugin#37 is merged and i am going to add it to our default webpack profile so we can support pnp natively.

@missing1984 missing1984 changed the title fix: bring back yarn v2 pnp support via custom webpack processor fix: add yarn v2 pnp support to default webpack processor Jul 21, 2021
@missing1984
Copy link
Contributor Author

@flotwig @jennifer-shehane I've added pnp-webpack-plugin to our @cypress/webpack-batteries-included-preprocessor so we can support pnp natively and close #8008. MR title and description are updated as well.

Let me know if there's anything i should do.

Copy link
Contributor

@flotwig flotwig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, @chrisbreiding can you take a quick look now that this is going to modify the behavior of the webpack preprocessor?

@flotwig
Copy link
Contributor

flotwig commented Jul 21, 2021

@missing1984 Thank you for the contribution!

@flotwig flotwig merged commit 74ada11 into cypress-io:develop Jul 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Plugins file fails on lodash import after upgrade to 7.1.0 Cypress and Yarn 2 PNP support
4 participants