Vite OverlayAPI Reference

API Reference

Last updated:

API Reference

errorOverlayPlugin(options?)

The default export. A Vite plugin that intercepts and enhances error display.

import errorOverlayPlugin from "@visulima/vite-overlay";

// vite.config.ts
export default defineConfig({
    plugins: [errorOverlayPlugin(options)],
});

Options

OptionTypeDefaultDescription
forwardConsolebooleantrueForward client runtime errors to the terminal
forwardedConsoleMethodsstring[]["error"]Console methods to intercept
logClientRuntimeErrorbooleanDeprecated. Use forwardConsole instead
overlayOverlayConfigOverlay UI configuration
reactPluginNamestringCustom React plugin name for detection
vuePluginNamestringCustom Vue plugin name for detection
showBallonButtonbooleanDeprecated. Use overlay.balloon.enabled instead
solutionFindersSolutionFinder[][]Custom solution finder handlers

Types

OverlayConfig

interface OverlayConfig {
    balloon?: BalloonConfig;
    /** Custom CSS injected into the shadow DOM */
    customCSS?: string | CSSProperties;
}

BalloonConfig

interface BalloonConfig {
    /** Show/hide the floating balloon button (default: true) */
    enabled?: boolean;
    /** Custom SVG icon for the balloon */
    icon?: string;
    /** Position of the balloon (default: "bottom-right") */
    position?: "top-left" | "top-right" | "bottom-left" | "bottom-right";
    /** Custom styles for the balloon */
    style?: string | CSSProperties;
}

VisulimaViteOverlayErrorPayload

The error payload sent to the client over WebSocket.

interface VisulimaViteOverlayErrorPayload {
    errors: ExtendedError[];
    errorType: "client" | "server";
    rootPath: string;
    solution?: Solution;
}

Client API

The plugin injects a window.__visulima_overlay__ object for programmatic control:

window.__visulima_overlay__.open();         // Show the overlay panel
window.__visulima_overlay__.close();        // Close/dismiss the overlay
window.__visulima_overlay__.getInstance();  // Get the current overlay instance (or null)
window.__visulima_overlay__.sendError(error: Error, loc?: ErrorLocation); // Report an error manually

ExtendedError

interface ExtendedError {
    message: string;
    name: string;
    stack: string;
    hint?: string;
    originalFilePath: string;
    originalFileLine: number;
    originalFileColumn: number;
    originalSnippet: string;
    originalStack?: string;
    originalCodeFrameContent?: string;
    compiledFilePath?: string;
    compiledLine?: number;
    compiledColumn?: number;
    compiledStack?: string;
    compiledCodeFrameContent?: string;
    fixPrompt: string;
    plugin?: string;
    errorCount?: number;
}
Support

Contribute to our work and keep us going

Community is the heart of open source. The success of our packages wouldn't be possible without the incredible contributions of users, testers, and developers who collaborate with us every day.Want to get involved? Here are some tips on how you can make a meaningful impact on our open source projects.

Ready to help us out?

Be sure to check out the package's contribution guidelines first. They'll walk you through the process on how to properly submit an issue or pull request to our repositories.

Submit a pull request

Found something to improve? Fork the repo, make your changes, and open a PR. We review every contribution and provide feedback to help you get merged.

Good first issues

Simple issues suited for people new to open source development, and often a good place to start working on a package.
View good first issues