vite-plugin-react-server
Version:
Vite plugin for React Server Components (RSC)
25 lines • 1.4 kB
TypeScript
/**
* Augments the opaque react-server-dom-esm client-reference failures that
* surface during static (`--app`) prerender with an actionable explanation.
*
* Two failure modes share the same root cause — a client module whose hosted
* moduleID is wrong — but react-server-dom-esm reports them without context:
*
* 1. "Attempted to load a Client Module outside the hosted root."
* Thrown by `serializeClientReference` when a client reference's `$$id`
* does not start with the bundler's baseURL (`moduleBasePath`). Happens
* when a `"use client"` module wasn't hosted (`/`-prefixed) — e.g. a
* directive-only client module that the build didn't recognize.
*
* 2. "Cannot find module '<dist/client>/…'"
* Thrown when the html-worker imports the hosted moduleID but no file was
* emitted there — e.g. a directive-only client module that was hosted but
* never added as a client/SSR build input.
*
* Neither message names the offending module (the id is discarded inside the
* vendored lib for case 1), so we attach the most actionable guidance we can:
* the likely cause and the fact that directive-only `"use client"` modules are
* supported, including the resolved path we *can* see for case 2.
*/
export declare function augmentClientReferenceError(error: unknown): unknown;
//# sourceMappingURL=augmentClientReferenceError.d.ts.map