initial commit
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
---
|
||||
title: Add an optional dependency
|
||||
sidebarTitle: Add an optional dependency
|
||||
mode: center
|
||||
---
|
||||
|
||||
To add an npm package as an optional dependency, use the `--optional` flag.
|
||||
|
||||
```sh terminal icon="terminal"
|
||||
bun add zod --optional
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
This adds the package to `optionalDependencies` in `package.json`.
|
||||
|
||||
```json package.json icon="file-json"
|
||||
{
|
||||
"optionalDependencies": {
|
||||
"zod": "^4.0.0" // [!code ++]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
See [`bun install`](/pm/cli/install).
|
||||
Reference in New Issue
Block a user