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

Add support for Yarn v2 #2799

Merged
merged 3 commits into from Dec 19, 2020
Merged

Add support for Yarn v2 #2799

merged 3 commits into from Dec 19, 2020

Conversation

doits
Copy link
Contributor

@doits doits commented Dec 2, 2020

This should make Webpacker support both Yarn 1 and 2. It comes down to the two changes:

  • Use correct yarn install flags
  • Add webpack and webpack-cli as direct per project dependencies, otherwise Yarn 2 complains about not finding the binary webpack

In addition nodeLinker: node-modules must be added to .yarnrc.yml for maximum compatibility, but this is left as an exercise for the user who wants to experiment with Yarn 2 for now.


I think supporting both Yarn versions – if those are really the only two changes – should be no problem. Later one could force to only supprt Yarn 2, but Rails must gain support for Yarn 2 before. See rails/rails#40722 for Yarn 2 support in Rails.

@n-rodriguez
Copy link
Contributor

@doits I've tested your branch and it works for me 👍

@n-rodriguez
Copy link
Contributor

I'm waiting for rails/rails#40722 to be merged but I'm not sure it will be in time for Rails 6.1 :/

This should make Webpacker support both Yarn 1 and 2. It comes down to
the two changes:

- Use correct `yarn install` flags
- Add `webpack` and `webpack-cli` as direct per project dependencies,
  otherwise Yarn 2 complains about not finding the binary `webpack`

In addition `nodeLinker: node-modules` must be added to `.yarnrc.yml`
for maximum compatibility, but this is left as an exercise for the user
who wants to experiment with Yarn 2 for now.
@doits
Copy link
Contributor Author

doits commented Dec 9, 2020

rails/rails#40722 is merged 👏 even into https://github.com/rails/rails/tree/6-1-stable – maybe this can be merged, too?

@n-rodriguez
Copy link
Contributor

Hi there! Any news?

@stouset
Copy link

stouset commented Aug 4, 2021

Yarn 3 is now out. :(

@pedrofurtado
Copy link
Member

pedrofurtado commented Aug 4, 2021

@stouset A new PR is already open for this purpose 🎉 🍻 : #3098

@stouset
Copy link

stouset commented Aug 7, 2021

Great news!

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.

None yet

5 participants