TX030
服务端渲染的路由需要持续运行的服务器
发生原因
某个页面导出了 runtime = "server":页面在服务器上渲染,并通过会话向每个打开的标签页流式传输帧,会话的存续时间与标签页相同。静态托管服务、Vercel Functions 和 Cloudflare Workers 无法维持这些会话,因此 text build --adapter static|vercel|cloudflare 会拒绝构建该应用,避免发布无法渲染的路由。
修复方法
使用持续运行的服务器部署:
text build --adapter bunbun dist/server.js# ortext build && text start或者移除该导出,在浏览器中渲染路由:
app/ops/page.tsxtsx
// Beforeexport const runtime = "server";// After: the default client runtime