- Notifications
You must be signed in to change notification settings - Fork15
Vite plugin for generating `com.chrome.devtools.json` on the fly in the devserver.
License
ChromeDevTools/vite-plugin-devtools-json
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Vite plugin for generating the Chrome DevTools project settings file on-the-flyin the devserver.
This enables seamless integration with the new Chrome DevTools features
npm install -D vite-plugin-devtools-json
Add it to your Vite config
import{defineConfig}from'vite';importdevtoolsJsonfrom'vite-plugin-devtools-json';exportdefaultdefineConfig({plugins:[devtoolsJson(),// ...]});
While the plugin can generate a UUID and save it in vite cache, you can alsospecify it in the options like in the following:
plugins: [ devtoolsJson({ uuid: "6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b" }), // ... ]| Name | Type | Default | Description |
|---|---|---|---|
projectRoot | string | config.root | Absolute path that will be reported to DevTools. Useful for monorepos or when the Vite root is not the desired folder. |
normalizeForWindowsContainer | boolean | true | Convert Linux paths to UNC form so Chrome on Windows (WSL / Docker Desktop) can mount them (e.g. via WSL or Docker Desktop). Passfalse to disable.Alias: normalizeForChrome (deprecated)_ |
uuid | string | auto-generated | Fixed UUID if you prefer to control it yourself. |
Example with all options:
import{defineConfig}from'vite';importdevtoolsJsonfrom'vite-plugin-devtools-json';exportdefaultdefineConfig({plugins:[devtoolsJson({projectRoot:'/absolute/path/to/project',normalizeForWindowsContainer:true,uuid:'6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b'})]});
The/.well-known/appspecific/com.chrome.devtools.json endpoint will serve theproject settings as JSON with the following structure
{"workspace": {"root":"/path/to/project/root","uuid":"6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b" }}whereroot is the absolute path to your{projectRoot} folder, anduuid isa random v4 UUID, generated the first time that you start the Vite devserverwith the plugin installed (it is henceforth cached in the Vite cache folder).
Checkoutbmeurer/automatic-workspace-folders-vanilla for a trivial exampleproject illustrating how to use the plugin in practice.
Googlers: We usego/wombat-dressing-roomfor publishing.
The code is underMIT License.
About
Vite plugin for generating `com.chrome.devtools.json` on the fly in the devserver.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.