UNPKG

vite-plugin-react-server

Version:
25 lines 1.36 kB
import type { ResolvedUserOptions } from "../../types.js"; /** * Auto-discovers first-party client modules detected by a top-of-file * `"use client"` DIRECTIVE rather than the `.client.` filename convention. * * Why this exists: `createGlobAutoDiscover("**\/*.client.*")` only finds * filename-convention client modules. A directive-only client module * (e.g. `src/components/Counter.tsx` starting with `"use client"`) was never * added as a client/SSR build input, so it was NOT emitted to `dist/client`. * The server build's `registerClientReference` then pointed its hosted * moduleID at a file that didn't exist, and the html-worker's import 404'd at * SSG-render time. * * Adding these modules as build inputs makes Vite emit them to `dist/client` * at preserved-module paths that line up with the hashed/hosted moduleIDs * generated in `createTransformerPlugin`. * * Detection is structural (`sourceHasTopLevelClientDirective`), never the * naive "contains the word client" substring test. */ export declare function createDirectiveClientAutoDiscover(modulePattern?: string): ({ inputs, userOptions, }: { inputs: Record<string, string>; userOptions: Pick<ResolvedUserOptions, "moduleBase" | "projectRoot" | "normalizer">; }) => Promise<Record<string, string>>; //# sourceMappingURL=createDirectiveClientAutoDiscover.d.ts.map