Island/Markdown pages lose CSS in production when it is imported through a component
Mantenedores costumam responder em até 1 dia
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 74/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- react, typescript, vite
- Domínio
- build-system, frontend
Direção de pesquisa
Start by reading void/dist/pages/islands-plugin.mjs, especially needsIslandClientBundle() and extractCssImports(), then trace how createClientAssetTags in void/dist/routing-assets-*.mjs uses the manifest. Reproduce with the linked project using pnpm build && pnpm preview; check that production output includes the CSS link for both / and /about, including when CSS is imported through a component.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Describe the bug
On island pages (*.island.tsx) and Markdown pages, CSS that is imported by a regular component (for example a shared Shell rendered by pages/layout.tsx) is applied in vite dev but missing from the production build. The rendered HTML has no <link rel="stylesheet">.
This is easy to miss because everything looks correct in dev.
Reproduction
https://github.com/Nkzn/void-islands-css-missing-repro
pnpm install
pnpm dev # / and /about have a red background
pnpm build && pnpm preview # / and /about have no stylesheet
src/Shell.tsximports./global.css;pages/layout.tsxrenders<Shell>.- In the production build,
dist/clientis not generated at all and the CSS only appears underdist/ssr/assets/.
Expected
Production output links the CSS that the page and its layouts depend on (as dev does), even when the page ships no JavaScript.
Possible cause
void/dist/pages/islands-plugin.mjsneedsIslandClientBundle()(L23) only checks the source text of*.island.*,layout.*and_*files for island imports or CSS imports written directly in those files. Transitive imports are not considered, so the islands client entry is not built here.extractCssImports()(L61) likewise only collects CSS imported directly in those files.
void/dist/routing-assets-*.mjs(createClientAssetTags, L115): when the islands client entry is not in the manifest, it returns empty asset tags, so no CSS link is emitted either.
Workaround
Import the CSS directly in pages/layout.tsx (import "../src/global.css"). Then virtual:void-islands-client is built and both pages get <link rel="stylesheet" href="/assets/islands-client-*.css">, still without any <script>.
Versions
[email protected],@void/[email protected],@void/[email protected][email protected], Node.js 24, pnpm 12, macOS
- Linguagem predominante
- TypeScript
- Estrelas
- 402
- Forks
- 32
- Merge médio
- 12h 28min
- PRs com merge (30d)
- 77
Preparar o ambiente
Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de voidzero-dev/void
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
voidzero-dev/void#478 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
voidzero-dev/void#463 ·
Mantenedores costumam responder em até 1 dia
-
Deploy after a secret change fails for Workers over ~750 KB: source read-back capped at 1 MiBAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
voidzero-dev/void#459 ·
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 1/5 1-3 horas Facilidade para iniciantes 78/100
voidzero-dev/void#428 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 68/100
voidzero-dev/void#480 ·
Mantenedores costumam responder em até 1 dia
Todas as issues de voidzero-dev/void
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
OpenPetsHQ/openpets#273 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
fritzprix/libr-agent#2161 ·
Mantenedores costumam responder em até 1 dia
-
macOS: clicking a menu item that has a submenu closes the menu instead of opening the submenuAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 83/100
blackboardsh/electrobun#581 ·
-
backlog-skill effort:xs frontend infra ready-for-agent
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
LucasSantana-Dev/Lucky#2862 ·
Mantenedores costumam responder em até 1 dia