vite.config 接入 vike 插件并改产出 dist/client+dist/server;feed 白名单 route 匹配 /、/board/:id、/post/:id(.html);spa catch-all ssr:false;onRenderHtml renderToReadableStream 等 allReady 输出完整 HTML 并带主题/缩放脚本;onRenderClient 沿用样式表等待+冷启动预热+hydrate 回退;getHomeStoreState 作用域 + hydrating 变体入 RequestScope;删除 index.html 与 main.tsx
12 lines
404 B
TypeScript
12 lines
404 B
TypeScript
import type { PageContext } from 'vike/types';
|
|
import { matchFeedSsrPath } from '../../src/ssr/feedPaths';
|
|
|
|
export { route };
|
|
|
|
/** SSR 白名单:`/`、`/board/:id`、`/post/:id`(含 `.html` 伪静态) */
|
|
function route(pageContext: PageContext) {
|
|
const match = matchFeedSsrPath(pageContext.urlPathname);
|
|
if (!match) return false;
|
|
return { routeParams: { kind: match.kind, id: match.id } };
|
|
}
|