-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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 dedupes inconsistently #6070
Comments
@yarnpkg/core looking for some discussion on the correct behavior here... Some of my notes from our discord discussion: if multiple patterns resolve to the same version you'll get more than 1 key to the same value
In the lockfile you get something like:
assuming that if you yarn upgrade
then re-adds the latest
(not saying that's "correct", just saying I'm pretty sure that's how the code currently works) @TheLudd suggests that after My feedback was: It's possible that if you had
if running
some people might find that to be a bug (yarn changed My concern is that I think the behavior might actually be a bit ... undefined at the moment.
so whether or not What I'm talking about with the "inconsistent" behavior is that if the dep tree used the same ranges from the original example:
In the lockfile you get:
then |
I totally agree. |
Just want to add another vote that the deduplication approach is the better one. The current state can make it difficult/impossible to upgrade a dependency without unlocking the full dependency tree or manually editing the lockfile, which is a big ask when you only want to upgrade a single package. |
I also think this conversation is discussing a solution for #3967 |
I'm using |
* Add definitions for React.memo * Add missing semicolons * Give a better name to the second argument to React.memo * Fix test to reflect correct usage of React.memo's second argument * Fix no-unnecessary-qualifier lints * Update other special components to be SpecialSFC * Ensure ordinary functions aren't assignable to SpecialSFC * createElement was resolving P to "{} | null" in some tests; add extends to prevent that * Fix the props of Fragment and StrictMode * Add tests for SpecialSFC assignability * Add scary doc comment to SpecialSFC's call signature Hopefully this trips tslint's deprecation rule. * Rename SpecialSFC to ExoticComponent * Add overload to React.memo to make it more ergonomic and avoid implicit any * Disable test that requires TS 3.1 * Add support for displayName in the exotic components that support it * Tone down the call signature's doc comment * Correct $ExpectType assertion * Try to implement LibraryManagedAttributes for the ExoticComponents that should support them This doesn't actually work because it seems only class components get them checked? * Add type definitions for new React 16.6 features This also attempts to add support for LibraryManagedAttributes to the ExoticComponents. * The fallback prop is required by Suspense * Declare legacy context on tests that use legacy context
There is currently an issue in yarn where it fails to deduplicate dependencies versions on `yarn install`. See this issue: yarnpkg/yarn#6070. This, coupled with a change in the definition of Component in @types/react, (DefinitelyTyped/DefinitelyTyped@9039892) breaks us as it forces us to use incompatible versions of @types/react. We can easily solve this by unlocking all our dependencies (by deleting node_modules & yarn.lock) and regenerating the lockfile from scratch. This is stable as it does not create a different lockfile than what yarn does on its own.
There is currently an issue in yarn where it fails to deduplicate dependencies versions on `yarn install`. See this issue: yarnpkg/yarn#6070. This, coupled with a change in the definition of Component in @types/react, (DefinitelyTyped/DefinitelyTyped@9039892) breaks us as it forces us to use incompatible versions of @types/react. We can easily solve this by unlocking all our dependencies (by deleting node_modules & yarn.lock) and regenerating the lockfile from scratch. This is stable as it does not create a different lockfile than what yarn does on its own. gitlint-ignore: line-length
There is currently an issue in yarn where it fails to deduplicate dependencies versions on `yarn install`. See this issue: yarnpkg/yarn#6070. This, coupled with a change in the definition of Component in @types/react, (DefinitelyTyped/DefinitelyTyped@9039892) breaks us as it forces us to use incompatible versions of @types/react. We can easily solve this by unlocking all our dependencies (by deleting node_modules & yarn.lock) and regenerating the lockfile from scratch. This is stable as it does not create a different lockfile than what yarn does on its own. gitlint-ignore: body-max-line-length
There is currently an issue in yarn where it fails to deduplicate dependencies versions on `yarn install`. See this issue: yarnpkg/yarn#6070. This, coupled with a change in the definition of Component in @types/react, (DefinitelyTyped/DefinitelyTyped@9039892) breaks us as it forces us to use incompatible versions of @types/react. We can easily solve this by unlocking all our dependencies (by deleting node_modules & yarn.lock) and regenerating the lockfile from scratch. This is stable as it does not create a different lockfile than what yarn does on its own. gitlint-ignore: body-max-line-length
After a discusion on discord with @rally25rs earlier this week I was advised to create an issue here for a discussion on how yarn handles deduping.
First, running
yarn dedupe
produces this output which is also available here:However,
yarn install
will infact not dedupe if you have a duplicated structure. Duplicated structures are created today when upgrading specific packages. The flow is usually something like this:node_modules
tree.This is a problem because you can get duplicate instances of react which is not valid. This is just an example however, there are other packages than react, such as our own internal modules at my company, where duplicated modules cause problems.
The only way now to deduplicate is to run a general
yarn upgrade
which has the side effect of upgrading all other dependencies as well.I am not sure if the current behavior is intended or not but IMO yarn should always deduplicate as much as possible. If I remember correctly, this was a goal of yarn when it was initially launched.
Could yarn be implemented to dedupe on upgrades?
The text was updated successfully, but these errors were encountered: