serverFunctions.components (dev): server-functions client is duplicated when @solidjs/web is in optimizeDeps.exclude, so post-boot server components resolve to undefined
维护者通常 1 天内回复
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 58/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- typescript, vite
- 领域
- build-system, devtools
调研方向
Start with the command === 'serve' && serverComponents dependency entry in src/index.ts, then trace how @solidjs/web/frames and compiled function references resolve their server-functions client imports when @solidjs/web is excluded from optimizeDeps. Reproduce using the supplied Vite config and click sequence; the issue is done when the dynamically mounted panel renders with the exclusion enabled and the existing no-exclusion and build-preview behavior still works.
由索引模型根据 Issue 内容生成。
描述
Versions: [email protected], @solidjs/[email protected], @solidjs/[email protected], [email protected] (first seen on rc.10 / next.46).
Repro
// vite.config.ts
export default defineConfig({
optimizeDeps: { exclude: ['@solidjs/web'] },
plugins: [solid({ ssr: true, start: { app: 'src/App.tsx' }, serverFunctions: { components: true } })],
})
// src/server.tsx
'use server'
export async function getPanel() {
return () => <section id="panel">server panel</section>
}
// src/App.tsx
export default function App() {
const [page, setPage] = createSignal('a')
const Panel = dynamic(() => getPanel())
return (
<>
<button id="go-b" onClick={() => setPage('b')}>go b</button>
{page() === 'a' ? <p id="page-a">page a</p> : <Loading><Panel /></Loading>}
</>
)
}
Run vite dev, load /, then click #go-b. The boundary is not in the document, so it mounts after boot.
Expected: the panel mounts, as it does without the exclude.
Actual: POST /_server/data/getPanel-… returns 200 application/x-frame-stream with the right chunks, but the call resolves to undefined and nothing mounts. A document-SSR'd (adopted) boundary still works, and vite build + vite preview work too.
Cause
With serverComponents, the plugin force-includes @solidjs/web/frames and @solidjs/web/server-functions (src/index.ts, the command === 'serve' && serverComponents entry) so that both share one instance of the transport config module. But @solidjs/web/frames imports @solidjs/web/server-functions/client. When the app excludes @solidjs/web, that subpath is neither included nor resolved to the optimized module:
node_modules/.vite/deps/@solidjs_web_frames.js→import … from "@solidjs/web/server-functions/client", which loads the raw node_modules file.- Compiled function references →
@solidjs/web/server-functions, which loads@solidjs_web_server-functions.js.
That gives two instances of the server-functions client. installServerComponents() calls configureServerFunctionsClient({ responseHandler }) on one of them, while the references call the other, which has no handler. The frame-stream response is therefore decoded as plain data.
Without the exclude, the frames bundle imports ./@solidjs_web_server-functions.js and everything shares one instance. Excluding @solidjs/web is common in apps that pin or link Solid.
Workaround
optimizeDeps: { exclude: ['@solidjs/web'], include: ['@solidjs/web/server-functions/client'] }
Suggested fix
When command === 'serve' && serverComponents, also force-include @solidjs/web/server-functions/client. Alternatively, have frames import the same specifier the references use.
- 主要语言
- TypeScript
- 星标
- 522
- 派生
- 73
- 平均合并
- 1 天 4 小时
- 30 天内合并 PR
- 35
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
solidjs/solid-vite-plugin 的其他 Issue
-
Test environment detection doesn't consider Vitest workspaces可能已有人在做 @carloitaben 于 57 天前认领。 未关闭1.x
难度 2/5 1-3 小时 新手友好度 78/100
solidjs/solid-vite-plugin#205 · 1 条评论 · 2 个 reaction ·
维护者通常 1 天内回复
-
[3.0.0-next.50 / next] Dev with a host-owned SSR environment: the first server-function call after startup, a restart or a new "use server" file waits a fixed 1 s可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 3/5 1-2 天 新手友好度 58/100
solidjs/solid-vite-plugin#427 ·
维护者通常 1 天内回复
-
Dev: a stylesheet shared by the entry and a lazy component moves after the lazy component's styles可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 3/5 半天 新手友好度 62/100
solidjs/solid-vite-plugin#425 ·
维护者通常 1 天内回复
-
[3.0.0-next.50 / next] SSR build: the $$moduleUrl export added to a Worker main module stops workerd from starting可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 3/5 半天 新手友好度 55/100
solidjs/solid-vite-plugin#420 ·
维护者通常 1 天内回复
-
Client setup seam: run app code before the generated entry's hydrate (start.clientSetup)可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 5/5 一周以上 新手友好度 25/100
solidjs/solid-vite-plugin#419 ·
维护者通常 1 天内回复
查看 solidjs/solid-vite-plugin 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
Koenkk/zigbee-herdsman-converters#13540 ·
维护者通常 1 天内回复
-
check:passed streams:add
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
area/busola/ux
难度 2/5 1-3 小时 新手友好度 68/100
kyma-project/busola#5442 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
vercel-labs/wterm#246 ·
维护者通常 1 天内回复