Skip to content

Commit

Permalink
docs: add section on peerDependenciesMeta field in package.json (fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
foxxyz committed Sep 18, 2020
1 parent bd2721d commit a25c489
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions docs/content/configuring-npm/package-json.md
Expand Up @@ -718,6 +718,30 @@ the host package's major version will break your plugin. Thus, if you've worked
with every 1.x version of the host package, use `"^1.0"` or `"1.x"` to express
this. If you depend on features introduced in 1.5.2, use `">= 1.5.2 < 2"`.

### peerDependenciesMeta

When a user installs a 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 your peer dependencies are to be used. Specifically, it allows peer dependencies to be marked as optional.

For example:

```json
{
"name": "tea-latte",
"version": "1.3.5",
"peerDependencies": {
"tea": "2.x",
"soy-milk": "1.2"
},
"peerDependenciesMeta": {
"soy-milk": {
"optional": true
}
}
}
```

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.

### bundledDependencies

This defines an array of package names that will be bundled when publishing
Expand Down

0 comments on commit a25c489

Please sign in to comment.