KC's Workspace
    Preparing search index...
    interface ViteDevServer {
        config: ResolvedConfig;
        environments: Record<"client" | "ssr" | string & {}, DevEnvironment>;
        hot: NormalizedHotChannel;
        httpServer: HttpServer | null;
        middlewares: Server;
        moduleGraph: ModuleGraph;
        pluginContainer: PluginContainer;
        resolvedUrls: ResolvedServerUrls | null;
        waitForRequestsIdle: (ignoredId?: string) => Promise<void>;
        watcher: FSWatcher;
        ws: WebSocketServer;
        bindCLIShortcuts(options?: BindCLIShortcutsOptions<ViteDevServer>): void;
        close(): Promise<void>;
        listen(port?: number, isRestart?: boolean): Promise<ViteDevServer>;
        openBrowser(): void;
        printUrls(): void;
        reloadModule(module: ModuleNode): Promise<void>;
        restart(forceOptimize?: boolean): Promise<void>;
        ssrFixStacktrace(e: Error): void;
        ssrLoadModule(
            url: string,
            opts?: { fixStacktrace?: boolean },
        ): Promise<Record<string, any>>;
        ssrRewriteStacktrace(stack: string): string;
        ssrTransform(
            code: string,
            inMap: SourceMap | { mappings: "" } | null,
            url: string,
            originalCode?: string,
        ): Promise<TransformResult | null>;
        transformIndexHtml(
            url: string,
            html: string,
            originalUrl?: string,
        ): Promise<string>;
        transformRequest(
            url: string,
            options?: TransformOptions,
        ): Promise<TransformResult | null>;
        warmupRequest(url: string, options?: TransformOptions): Promise<void>;
    }
    Index

    Properties

    The resolved vite config object

    environments: Record<"client" | "ssr" | string & {}, DevEnvironment>

    Module execution environments attached to the Vite server.

    An alias to server.environments.client.hot. If you want to interact with all environments, loop over server.environments.

    httpServer: HttpServer | null

    native Node http server instance will be null in middleware mode

    middlewares: Server

    A connect app instance.

    • Can be used to attach custom middlewares to the dev server.
    • Can also be used as the handler function of a custom http server or as a middleware in any connect-style Node.js frameworks

    https://github.com/senchalabs/connect#use-middleware

    moduleGraph: ModuleGraph

    Module graph that tracks the import relationships, url to file mapping and hmr state.

    pluginContainer: PluginContainer

    Rollup plugin container that can run plugin hooks on a given file

    resolvedUrls: ResolvedServerUrls | null

    The resolved urls Vite prints on the CLI (URL-encoded). Returns null in middleware mode or if the server is not listening on any port.

    waitForRequestsIdle: (ignoredId?: string) => Promise<void>

    Calling await server.waitForRequestsIdle(id) will wait until all static imports are processed. If called from a load or transform plugin hook, the id needs to be passed as a parameter to avoid deadlocks. Calling this function after the first static imports section of the module graph has been processed will resolve immediately.

    watcher: FSWatcher

    Chokidar watcher instance. If config.server.watch is set to null, it will not watch any files and calling add or unwatch will have no effect. https://github.com/paulmillr/chokidar/tree/3.6.0#api

    WebSocket server with send(payload) method

    Methods