mirror of
https://gh-proxy.org/https://github.com/klinsmaya/multica.git
synced 2026-11-11 02:46:45 +08:00
* fix(docs): stop default-locale pages failing hydration with React #418 SSG prerenders each page under its canonical `[lang]` route, so client components see `/en/agents` as the pathname at build time, while the browser URL for the hidden default locale is `/agents` (the i18n middleware rewrites it). Fumadocs resolves the page tree path with `usePathname()`, and the tree stores default-locale URLs without the prefix — so the prerendered HTML rendered tree-path fallbacks ("On this page" in the TOC popover trigger) while hydration resolved the real page name ("Agents"). The text mismatch threw React error #418 on every EN page load and React regenerated the whole tree on the client, dropping SSR-injected elements such as the next/font preload links. Non-default locales matched on both sides and were unaffected. Wrap the docs layout in fumadocs' `FrameworkProvider` with a `usePathname` that strips the hidden default-locale prefix, so prerender and hydration see the same locale-less path the page tree uses. The prerendered HTML now carries the real page names as well. Non-default locales keep their `/zh`-style prefix and behave exactly as before. Fixes #9243 * fix(docs): preserve static image imports in framework provider Co-authored-by: multica-agent <[email protected]> --------- Co-authored-by: Bohan-J <[email protected]> Co-authored-by: multica-agent <[email protected]>
20 lines
390 B
TypeScript
20 lines
390 B
TypeScript
import { defineConfig } from "vitest/config";
|
|
import path from "path";
|
|
|
|
export default defineConfig({
|
|
oxc: {
|
|
jsx: { runtime: "automatic" },
|
|
},
|
|
test: {
|
|
environment: "node",
|
|
globals: true,
|
|
include: ["**/*.test.{ts,tsx}"],
|
|
exclude: ["node_modules/**", ".next/**", ".source/**"],
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
"@": path.resolve(__dirname, "."),
|
|
},
|
|
},
|
|
});
|