Enforce hoisting of some packages to fix giant disk size with Yarn
Created by: gaearon
Yarn has known issues deduplicating dependencies, sometimes failing to hoist dependencies shared between a ton of packages (such as babel-runtime
) and producing installs 5 times bigger than npm: https://github.com/yarnpkg/yarn/issues/2306.
While we could disable Yarn integration (https://github.com/facebookincubator/create-react-app/issues/1390), I'd like to explore an alternative approach. We should be able to determine which package causes most duplication, and then hoist it manually by making it an explicit dependency of react-scripts
. This would ensure Yarn deduplicates it. This is a temporary workaround until Yarn actually fixes the algorithm (tracked in https://github.com/yarnpkg/yarn/issues/2306).
Please don't hesitate to help with this. You would need to:
- Reproduce the issue with giant (~1GB) install locally with Yarn.
- Figure out which dependencies get duplicated. (I don't know the easiest way but you could probably look at Babel packages and see which dependencies end up in
node_modules
of each of them.) - Add the duplicated dependencies to
react-scripts
itself to hoist them. - Verify that the issue is resolved.