-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Set prefer-dedupe
as the default.
#61630
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Size Change: 0 B Total Size: 1.75 MB ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, let's give it a try. Thanks!
I noticed Core doesn't have this, shall we set it there as well @desrosj? https://github.com/WordPress/wordpress-develop/blob/trunk/.npmrc |
This change was applied in Gutenberg: WordPress/gutenberg#61630 Quoting that : > The `npm dedupe` command searches > and attempts to simplify the overall structure of the local package > tree to allow dependent packages to be shared more effectively. As > detailed in #61532, reducing the amount of dependency duplication is > beneficial for a few reasons: > > - Fewer packages overall. > - Faster installation. > - Less size to transfer and store on disk. > - Usually bundle size is reduced (although this depends on which > versions of packages are used). > > However, unless the command is run regularly, the project's dependency > tree easily falls out of order. See https://docs.npmjs.com/cli/v10/commands/npm-dedupe
I created WordPress/wordpress-develop#7537 to add the config. |
What?
This sets
prefer-dedupe
totrue
in the.npmrc
file.See discussions in #61486 and #61532.
Why?
The
npm dedupe
command searches and attempts to simplify the overall structure of the local package tree to allow dependent packages to be shared more effectively. As detailed in #61532, reducing the amount of dependency duplication is beneficial for a few reasons:However, unless the command is run regularly, the project's dependency tree easily falls out of order.
How?
By configuring
prefer-dedupe
, npm should avoid duplication as much as possible by default.This also includes one more
npm dedupe
run. In my testing, adding the value to the.npmrc
did not retroactively apply the policy (unless I've not correctly configured the setting here).