Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

Generated client entry runs before the root is parsed (async script in <head>)

Fechada
#411 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
25/100
Tipo de issue
Bug
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
typescript, vite

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

@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 with async removed. It hydrates every time.
  • /stream: a streamed page with a 3 s <Loading> read. DOMContentLoaded fires when the response ends (~3 s), while the async entry starts hydration at ~100 ms. So waiting for DOMContentLoaded, or dropping async, would make every streamed page wait for its slowest read.
Linguagem predominante
TypeScript
Estrelas
522
Forks
73
Merge médio
1d 4h
PRs com merge (30d)
35

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de solidjs/solid-vite-plugin

Todas as issues de solidjs/solid-vite-plugin

Issues semelhantes

Mais issues de TypeScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.