aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Lawlzer <Kevindaspam@gmail.com> 2023-04-05 17:02:08 -0500
committerGravatar GitHub <noreply@github.com> 2023-04-05 15:02:08 -0700
commitf7d0eee0ac99e621b6762982edaed255b654c541 (patch)
treeefa25ea2f8d0ea604d03106e978b7e5c0eb37a36
parentac092a1e043c834c99dd9bd81d4d6e6e6d32acbd (diff)
downloadbun-f7d0eee0ac99e621b6762982edaed255b654c541.tar.gz
bun-f7d0eee0ac99e621b6762982edaed255b654c541.tar.zst
bun-f7d0eee0ac99e621b6762982edaed255b654c541.zip
In Documentation, move --watch before the script name (#2569)
Related message by Jarred: https://discord.com/channels/876711213126520882/876711213126520885/1093286199369682944 If you put `--watch` after the script name, it will not work.
-rw-r--r--docs/runtime/hot.md9
1 files changed, 5 insertions, 4 deletions
diff --git a/docs/runtime/hot.md b/docs/runtime/hot.md
index 25edd6e35..275ae8573 100644
--- a/docs/runtime/hot.md
+++ b/docs/runtime/hot.md
@@ -7,16 +7,17 @@ Bun supports two kinds of automatic reloading via CLI flags:
Watch mode can be used with `bun test` or when running TypeScript, JSX, and JavaScript files.
+
To run a file in `--watch` mode:
```bash
-$ bun index.tsx --watch
+$ bun --watch index.tsx
```
To run your tests in `--watch` mode:
```bash
-$ bun test --watch
+$ bun --watch test
```
In `--watch` mode, Bun keeps track of all imported files and watches them for changes. When a change is detected, Bun restarts the process, preserving the same set of CLI arguments and environment variables used in the initial run. If Bun crashes, `--watch` will attempt to automatically restart the process.
@@ -34,7 +35,7 @@ The following examples show Bun live-reloading a file as it is edited, with VSCo
{% codetabs %}
```bash
-$ bun run watchy.tsx --watch
+$ bun run --watch watchy.tsx
```
```tsx#watchy.tsx
@@ -57,7 +58,7 @@ serve({
Running `bun test` in watch mode and `save-on-keypress` enabled:
```bash
-$ bun test --watch
+$ bun --watch test
```
![bun test gif](https://user-images.githubusercontent.com/709451/228396976-38a23864-4a1d-4c96-87cc-04e5181bf459.gif)