Skip to content
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

docs: additional notes for watch flag #10963

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions docs/cli/run.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,27 @@ $ bun run dev --watch # ❌ don't do this
Flags that occur at the end of the command will be ignored and passed through to the `"dev"` script itself.
{% /callout %}

Keep in mind that when using `bun start` or `bun run` to run a package script, direct use of the `--watch` flag will generally be ignored, seeing as package scripts specify command line operations of their own. To use watch with a package script, add the flag to the script itself. For example:

{% callout %}
In your package.json file:

```json
{
"scripts": {
"dev": "bun --watch run index.ts"
}
}
```

Then on the command line:

```bash
$ bun run dev # ✔️ the script takes care of the watch flag
$ bun --watch run dev # ❌ use of the watch flag here is not picked up by the script
```
{% /callout %}

## Run a `package.json` script

{% note %}
Expand Down