Skip to content

Commit d96dadc

Browse files
committed
docs: improve usage guide
1 parent 4065df9 commit d96dadc

1 file changed

Lines changed: 33 additions & 20 deletions

File tree

docs/guide/index.md

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -36,32 +36,19 @@ Install or upgrade your Vite to the beta version 13+:
3636
}
3737
```
3838

39-
Install the required DevTools plugin for both client modes:
39+
Install the required DevTools package:
4040

4141
```bash
4242
pnpm add -D @vitejs/devtools
4343
```
4444

45-
Vite DevTools supports two client modes: embedded and standalone. You can choose the mode in your Vite config.
45+
Vite DevTools has two client modes. Configure one mode at a time.
4646

47-
Use embedded mode:
47+
### Standalone mode
4848

49-
```ts [vite.config.ts] twoslash
50-
import { DevTools } from '@vitejs/devtools'
51-
import { defineConfig } from 'vite'
49+
The DevTools client runs in a standalone window (no user app).
5250

53-
export default defineConfig({
54-
plugins: [
55-
DevTools(),
56-
],
57-
build: {
58-
rolldownOptions: {
59-
devtools: {}, // enable devtools mode
60-
},
61-
}
62-
})
63-
```
64-
Or use standalone mode:
51+
Configure `vite.config.ts`:
6552

6653
```ts [vite.config.ts] twoslash
6754
import { defineConfig } from 'vite'
@@ -73,19 +60,45 @@ export default defineConfig({
7360
})
7461
```
7562

76-
Run a Vite build to generate Rolldown build metadata. In standalone mode, DevTools also starts a local server to host the client after the build completes.
63+
Run:
7764

7865
```bash
7966
pnpm build
8067
```
8168

69+
After the build completes, open the DevTools URL shown in the terminal.
8270

83-
If you're using embedded mode, start your app and open the DevTools panel in the browser:
71+
### Embedded mode
72+
73+
The DevTools client runs inside an embedded floating panel.
74+
75+
Configure `vite.config.ts`:
76+
77+
```ts [vite.config.ts] twoslash
78+
import { DevTools } from '@vitejs/devtools'
79+
import { defineConfig } from 'vite'
80+
81+
export default defineConfig({
82+
plugins: [
83+
DevTools(),
84+
],
85+
build: {
86+
rolldownOptions: {
87+
devtools: {}, // enable devtools mode
88+
},
89+
}
90+
})
91+
```
92+
93+
Run:
8494

8595
```bash
96+
pnpm build
8697
pnpm dev
8798
```
8899

100+
Then open your app in the browser and open the DevTools panel.
101+
89102
## What's Next?
90103

91104
Now that you have Vite DevTools set up, you can:

0 commit comments

Comments
 (0)