Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Start mode dev: server component pages fail to serialize (seroval "[object Object] cannot be parsed")

未关闭
#394 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
65/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
typescript, vite

调研方向

Start with the Vite configuration and the server-component route in src/routes/index.tsx, then reproduce with pnpm dev and curl http://localhost:5173/. Compare the dev SSR module graph with the working vite build && node dist/server/node.js path, focusing on seroval and seroval-plugins externalization and the noExternal workaround. Done means the dev response contains the expected main element without the seroval parse error.

由索引模型根据 Issue 内容生成。

描述

[Opus-5.5] On behalf of Elies

In SSR start mode with serverFunctions: { components: true }, a file route whose page is a server component renders an empty document under vite dev. The server logs SSR_RENDER_ERROR_CONTAINED with a seroval parse error. The production build of the same app renders the page correctly.

Versions: solid-js and @solidjs/web 2.0.0-rc.13, @solidjs/vite-plugin 3.0.0-next.47, @solidjs/router 2.0.0-next.35, filesystem-routing 0.4.0, vite 8.3.2, seroval and seroval-plugins 1.6.8 (one copy installed), Node 24.18, pnpm 10.32, Linux.

Minimal reproduction:

// vite.config.ts
import { defineConfig } from 'vite';
import solid from '@solidjs/vite-plugin';
import { fileRoutes } from 'filesystem-routing/vite';

export default defineConfig({
  plugins: [
    solid({ start: { node: true }, ssr: true, serverFunctions: { components: true }, extensions: ['.jsx', '.tsx'] }),
    fileRoutes({ serverComponents: true }),
  ],
});
// src/App.tsx
import { pageRoutes } from 'virtual:file-routes';
import { createRouter } from '@solidjs/router';
import { fileRoutes } from '@solidjs/router/fs';

const Router = createRouter({ routes: fileRoutes(pageRoutes) });

export default function App() {
  return <Router>{(props) => props.children}</Router>;
}
// src/routes/index.tsx
export default async function Home() {
  'use server';
  return () => <main>Hello from a server component</main>;
}

Steps: pnpm dev, then curl http://localhost:5173/.

Expected: a document containing <main>Hello from a server component</main>, as vite build && node dist/server/node.js produces.

Actual: the response body is only <!DOCTYPE html>, and the dev server logs:

[SSR_RENDER_ERROR_CONTAINED] Render error outside any boundary — the request failed: Error: Seroval caught an error during the parsing process.
The value [object Object] of type "object" cannot be parsed/serialized.
  cause: SerovalUnsupportedTypeError
    at parseObjectPhase2 (seroval/dist/dev/index.js)
    at Object.stream (seroval-plugins/dist/dev/web-*.js)   <- ReadableStreamPlugin
    ...
    at armDocumentLiveHoles (@solidjs/web/frames/dist/server.dev.js)

The failing call is ctx.serialize("sc:live", new ReadableStream(...)) in armDocumentLiveHoles. ReadableStreamPlugin then fails to parse its READABLE_STREAM_FACTORY reference.

Workaround: inlining seroval in the SSR environment fixes dev:

ssr: { noExternal: ['seroval', 'seroval-plugins'] },

That suggests the dev SSR graph gets two seroval module instances. solid-js and @solidjs/web are added to noExternal, while seroval and seroval-plugins stay external, so the reference registered by one instance isn't found by the other. I haven't confirmed that beyond the workaround.

主要语言
TypeScript
星标
522
派生
72
平均合并
20 小时 1 分钟
30 天内合并 PR
31

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

solidjs/solid-vite-plugin 的其他 Issue

查看 solidjs/solid-vite-plugin 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。