How-to · @faultatlas/dev-vite
Connect local debugging to Vite
Bind development error capture to a Vite application lifecycle.
The Vite adapter reports browser errors and unhandled rejections through callbacks you provide. It does not create a telemetry client or debug runtime.
Start the development adapter
Connect disposal to Vite hot module replacement so the adapter removes listeners before a module reload.
import { createViteDevAdapter } from "@faultatlas/dev-vite";
const adapter = createViteDevAdapter({
onError: () => console.warn("Vite client error captured"),
hotDispose: (dispose) => import.meta.hot?.dispose(dispose),
});
adapter.start();Call stop() to remove listeners while retaining the adapter for another start. Call dispose() for final teardown.
Start the debug host with the Vite server
Use the separate Node-only plugin entry point from vite.config.ts. Registration remains explicit.
import { createViteDebugHostPlugin } from "@faultatlas/dev-vite/plugin";
const plugin = createViteDebugHostPlugin({
runtime: { state: { vite: () => ({ mode: "development" }) } },
onReady: ({ port }) => console.info(`FaultAtlas debug port: ${port}`),
});The plugin starts the existing loopback host with the Vite development server and stops it when that server closes. Registration runs in the Node-side Vite config process and does not expose browser application stores. It is not an HMR data bridge, automatic store discovery mechanism or remote live-debug channel. Register the inspected state through the debug runtime.