From f6fff3295d19b63003cf49eb1c4805f453c5390a Mon Sep 17 00:00:00 2001 From: Hong Xu Date: Wed, 1 May 2024 12:25:50 -0700 Subject: [PATCH] docs: clarify what peerDependenciesMeta does (#7433) Co-authored-by: Gar --- docs/lib/content/configuring-npm/package-json.md | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/docs/lib/content/configuring-npm/package-json.md b/docs/lib/content/configuring-npm/package-json.md index 9727e7e77f909..2755b8008d014 100644 --- a/docs/lib/content/configuring-npm/package-json.md +++ b/docs/lib/content/configuring-npm/package-json.md @@ -818,11 +818,12 @@ to express this. If you depend on features introduced in 1.5.2, use ### peerDependenciesMeta -When a user installs your package, npm will emit warnings if packages -specified in `peerDependencies` are not already installed. The -`peerDependenciesMeta` field serves to provide npm more information on how +The `peerDependenciesMeta` field serves to provide npm more information on how your peer dependencies are to be used. Specifically, it allows peer -dependencies to be marked as optional. +dependencies to be marked as optional. Npm will not automatically install +optional peer dependencies. This allows you to +integrate and interact with a variety of host packages without requiring +all of them to be installed. For example: @@ -842,11 +843,6 @@ For example: } ``` -Marking a peer dependency as optional ensures npm will not emit a warning -if the `soy-milk` package is not installed on the host. This allows you to -integrate and interact with a variety of host packages without requiring -all of them to be installed. - ### bundleDependencies This defines an array of package names that will be bundled when publishing