-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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 2.0 (Yarn Plug’n’Play) #2112
Comments
Will pnp put all the modules in a singular global source of truth location on the local system, or will this still require downloading at least one new copy of them from the internet at every install, even if another project already uses the same version? |
From the whitepaper (very short read):
So, instead of 100M of modules in a |
PnP was exactly what I thought about when I read the thread at rails/rails#36282, great to see there is a will to tackle this. I would be interested in taking a look at implementing this but I am super new to webpacker. Let me see how fast I can get familiar with it to make a contribution. |
I have tried it out and can confirm that webpacker needs to implement something like peerDependencies in order to make this work. Error with the default setup: Add this to "installConfig": {
"pnp": true
} The errors
If you meticulously install all of the deps you need with PnP, the starter files will actually compile successfully: @gauravtiwari, This is only possible since you already did some work last year to enable PnP 🎉: https://github.com/rails/webpacker/pull/1823/files#diff-1701de23f718ce36149c9b23e2db08caR95 First glance action items:
|
Thanks @jakeNiemiec Sorry about the delay. I will take a look tomorrow and get back to you. |
just my 2 cents on |
With |
FWIW I attempted to use Yarn 2 about 4 months ago to see what would happen w/ Webpacker, and this is the discussion it led to on the Yarn 2 (aka berry) repo: yarnpkg/berry#494 |
I wanted to add this resource for anyone looking to try this out: https://next.yarnpkg.com/getting-started It now occurs to me that migrating to Yarn 2.0 will require 2 major efforts:
Both of these involve cutting reliance on |
Shouldn't it work with |
Yes, that would be the ideal migration for Webpacker / Rails. That's what we typically recommend in our migration guide:
|
I just tested it and it seems to work with two additional steps. I did this to upgrade and it is working in my development setup: $ yarn set version berry
$ echo "nodeLinker: node-modules" >> .yarnrc.yml
$ yarn
$ yarn add webpack@^4.0 webpack-cli@^4.0 # otherwise it will complain about not finding the binary `webpack` Compiling in development mode! Tested with current |
I created #2799 with the changes needed to experimentally support Yarn 2, e.g. not to break when Yarn 2 is used. |
Thank you! It works here :) |
Yarn v2移行のデフォルトはPlug'n'Playがオンになっている。 PnPはパッケージ内容をレポジトリに含めてキャッシュし、node_modulesディレクトリを使わない。 そのため高速かつ再現性よく動作するようになっている。 しかし、rails/webpackerがまだYarnのPnPに対応していないようである。 ttps://github.com/rails/webpacker/issues/2112 そのため、PnPをまだ使わず、node_modulesディレクトリを使い続ける設定にした。
Is there any word of plans/intentions from webpacker/rails maintainers? |
A heads up for projects using https://github.com/shakacode/react_on_rails and Yarn 2: React on Rails's Rake Unknown Syntax Error: Unsupported option name ("--no-progress"). This is due to Yarn 2 no longer supporting some Yarn 1 For the time being, |
Hi @shamrt, can you tell us a bit more about your requirements for rails/webpacker with react_on_rails? @guillaumebriday, maybe I can add a test case for react_on_rails using yarn v2? I could update https://github.com/shakacode/react_on_rails_tutorial_with_ssr_and_hmr_fast_refresh with yarn v2? @guillaumebriday it seems odd that rails/webpacker has to worry about very specific flags for yarn. Seems out of scope for the project and a good example of how keeping things leaner is better. |
Feel free to reopen this issue here: |
Thanks @justin808 , can you provide a link explaining the origin of |
@dhh suggested the name for the fork 😄 and it's listed on the README.md for https://github.com/rails/webpacker. |
Summary from whitepaper:
Pros:
node_modules
folderCons:
node_modules
folder (some webpacker stuff currently relies on this). You also can't edit anything innode_modules
@rails/webpacker
as if they were direct dependencies)Resources:
Newer links:
The text was updated successfully, but these errors were encountered: