Generated client entry runs before the root is parsed (async script in <head>)
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 25/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- typescript, vite
- 领域
- build-system, frontend
调研方向
The injected script tag is generated in src/ssr/index.ts around lines 1387-1391, where the entry is placed before </head> with the async attribute. Read how the plugin chooses between async and deferred output, and check the linked repro's /, /?defer and /stream cases. Done means a fix that hydrates the slow-HTML and streamed pages without making streamed pages wait for their slowest read. Expect a design discussion about the trade-off before code.
由索引模型根据 Issue 内容生成。
描述
@solidjs/vite-plugin 3.0.0-next.49 injects the generated client entry before </head> as <script type="module" async>:
https://github.com/solidjs/solid-vite-plugin/blob/44d90fd7fb8ae6d0efc6a42c82ad2d91adc3658a/src/ssr/index.ts#L1387-L1391
An async module runs as soon as it loads. When the HTML arrives slowly, the entry can run while the browser is still parsing the body. Hydration then reaches nodes that do not exist yet and fails with Cannot read properties of null (reading 'nextSibling') (or 'firstChild'). Nothing after that point hydrates.
Repro: https://stackblitz.com/github/feledori/solid-async-entry-repro
/: a long page served at 2 kB per 50 ms. Hydration fails on every load, and the buttons near the end do nothing./?defer: the same page withasyncremoved. It hydrates every time./stream: a streamed page with a 3 s<Loading>read.DOMContentLoadedfires when the response ends (~3 s), while the async entry starts hydration at ~100 ms. So waiting forDOMContentLoaded, or droppingasync, would make every streamed page wait for its slowest read.
- 主要语言
- 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/5 1-2 天 新手友好度 58/100
solidjs/solid-vite-plugin#428 ·
维护者通常 1 天内回复
-
难度 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未关闭
难度 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 天内回复
查看 solidjs/solid-vite-plugin 的全部 Issue
相似的 Issue
-
freshness freshness:observed-only
难度 2/5 1-3 小时 新手友好度 68/100
thoroc/context-radar#280 ·
-
难度 2/5 1-3 小时 新手友好度 66/100
-
documentation story
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复
-
bug category:billing priority:p3 track:fast
难度 2/5 1-3 小时 新手友好度 72/100
LanternOps/breeze#9223 ·
维护者通常 1 天内回复