|
8 | 8 |
|
9 | 9 | ## Using DevTools |
10 | 10 |
|
11 | | -When running your Worker locally using `wrangler dev`, you automatically have access to [Cloudflare's implementation](https://github.com/cloudflare/workers-sdk/tree/main/packages/chrome-devtools-patches) of [Chrome's DevTools](https://developer.chrome.com/docs/devtools/overview). |
12 | | -DevTools help you debug and optimize your Workers. |
| 11 | +When running your Worker locally using the [Wrangler CLI](https://developers.cloudflare.com/workers/wrangler/) (`wrangler dev`) or using [Vite](https://vite.dev/) with the [Cloudflare Vite Plugin](https://developers.cloudflare.com/workers/vite-plugin/), you automatically have access to [Cloudflare's implementation](https://github.com/cloudflare/workers-sdk/tree/main/packages/chrome-devtools-patches) of [Chrome's DevTools](https://developer.chrome.com/docs/devtools/overview). |
13 | 12 |
|
14 | | -:::note |
15 | | -You may have experience using Chrome's DevTools for frontend development. Notably, Worker DevTools are used for backend code and _not_ client-side JavaScript. |
16 | | -::: |
| 13 | +You can use Chrome DevTools to: |
| 14 | + |
| 15 | +- View logs directly in the Chrome console |
| 16 | +- [Debug code by setting breakpoints](/workers/observability/dev-tools/breakpoints/) |
| 17 | +- [Profile CPU usage](/workers/observability/dev-tools/cpu-usage/) |
| 18 | +- [Observe memory usage and debug memory leaks in your code that can cause out of memory (OOM) errors](/workers/observability/dev-tools/memory-usage/) |
17 | 19 |
|
18 | 20 | ## Opening DevTools |
19 | 21 |
|
20 | | -To get started, run your Worker in development mode with `wrangler dev`, then open the DevTools in the browser by pressing the `D` key from your terminal. Now when you access this worker locally, it can be debugged and profiled with this DevTools instance. |
| 22 | +### Wrangler |
| 23 | + |
| 24 | +- Run your Worker locally, by running `wrangler dev` |
| 25 | +- Press the `D` key from your terminal to open devtools in a browser tab |
21 | 26 |
|
22 | | -Alternatively, both the [Cloudflare Dashboard](https://dash.cloudflare.com/) and the [Worker's Playground](https://workers.cloudflare.com/playground) include DevTools in their UI. |
| 27 | +### Vite |
23 | 28 |
|
24 | | -## DevTool use cases |
| 29 | +- Run your worker locally, by running `vite` |
| 30 | +- In a new Chrome tab, open the debug URL that shows in your console, for example, `http://localhost:5173/__debug` |
25 | 31 |
|
26 | | -DevTools can be used in a variety of situations. For more information, see the documentation: |
| 32 | +### Dashboard Editor & Playground |
27 | 33 |
|
28 | | -- [Debugging code via breakpoints and logging](/workers/observability/dev-tools/breakpoints/) |
29 | | -- [Profiling CPU usage](/workers/observability/dev-tools/cpu-usage/) |
30 | | -- [Addressing out of memory (OOM) errors](/workers/observability/dev-tools/memory-usage/) |
| 34 | +Both [Cloudflare Dashboard](https://dash.cloudflare.com/) and the [Worker's Playground](https://workers.cloudflare.com/playground) include DevTools in the UI. |
31 | 35 |
|
32 | 36 | ## Related resources |
33 | 37 |
|
|
0 commit comments