diff options
Diffstat (limited to 'docs/guides/install/add-optional.md')
-rw-r--r-- | docs/guides/install/add-optional.md | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/docs/guides/install/add-optional.md b/docs/guides/install/add-optional.md new file mode 100644 index 000000000..6d02c23e2 --- /dev/null +++ b/docs/guides/install/add-optional.md @@ -0,0 +1,25 @@ +--- +name: Add an optional dependency +--- + +To add an npm package as a peer dependency, use the `--optional` flag. + +```sh +$ bun add zod --optional +``` + +--- + +This will add the package to `optionalDependencies` in `package.json`. + +```json-diff +{ + "optionalDependencies": { ++ "zod": "^3.0.0" + } +} +``` + +--- + +See [Docs > Package manager](/docs/cli/install) for complete documentation of Bun's package manager. |