Skip to content

Commit 09a2dab

Browse files
Sync cli docs (#1391)
sync cli docs Co-authored-by: svelte-docs-bot[bot] <196124396+svelte-docs-bot[bot]@users.noreply.github.com>
1 parent b4416a7 commit 09a2dab

File tree

2 files changed

+36
-22
lines changed

2 files changed

+36
-22
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
NOTE: do not edit this file, it is generated in apps/svelte.dev/scripts/sync-docs/index.ts
3+
title: devtools-json
4+
---
5+
6+
The `devtools-json` add-on installs [`vite-plugin-devtools-json`](https://github.com/ChromeDevTools/vite-plugin-devtools-json/), which is a Vite plugin for generating a Chromium DevTools project settings file on-the-fly in the development server. This file is served from `/.well-known/appspecific/com.chrome.devtools.json` and tells Chromium browsers where your project's source code lives so that you can use [the workspaces feature](https://developer.chrome.com/docs/devtools/workspaces) to edit source files in the browser.
7+
8+
> [!NOTE]
9+
> Installing the plugin enables the feature for all users connecting to the dev server with a Chromium browser, and allows the browser to read and write all files within the directory. If using Chrome's AI Assistance feature, this may also result in data being sent to Google.
10+
11+
You can prevent the request from being issued on your machine by disabling the feature in your browser. You can do this in Chrome by visiting `chrome://flags` and disabling the "DevTools Project Settings". You may also be interested in disabling "DevTools Automatic Workspace Folders" since it’s closely related.
12+
13+
You can also prevent the web server from issuing a notice regarding the incoming request for all developers of your application by handling the request yourself. For example, you can create a file named `.well-known/appspecific/com.chrome.devtools.json` with the contents `"Go away, Chrome DevTools!"` or you can add logic to respond to the request in your [`handle`](https://svelte.dev/docs/kit/hooks#Server-hooks-handle) hook:
14+
15+
```js
16+
/// file: src/hooks.server.js
17+
import { dev } from '$app/environment';
18+
19+
export function handle({ event, resolve }) {
20+
if (dev && event.url.pathname === '/.well-known/appspecific/com.chrome.devtools.json') {
21+
return new Response(undefined, { status: 404 });
22+
}
23+
24+
return resolve(event);
25+
}
26+
```
27+
28+
## Usage
29+
30+
```bash
31+
npx sv add devtools-json
32+
```
33+
34+
## What you get
35+
36+
- `vite-plugin-devtools-json` added to your Vite plugin options

apps/svelte.dev/content/docs/cli/30-add-ons/60-devtools-json.md

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)