Island/Markdown pages lose CSS in production when it is imported through a component
Los mantenedores suelen responder en 1 día
Ya se ha fusionado un pull request relacionado.
- #481 de @Brooooooklyn — fusionado
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 74/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- react, typescript, vite
- Área
- build-system, frontend
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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
- Lenguaje dominante
- TypeScript
- Estrellas
- 402
- Forks
- 32
- Merge medio
- 11 h 52 min
- PR fusionados (30 d)
- 88
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de voidzero-dev/void
-
bug
Dificultad 1/5 1-3 horas Aptitud para principiantes 78/100
voidzero-dev/void#428 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
voidzero-dev/void#511 ·
Los mantenedores suelen responder en 1 día
-
Platform email: outbound-only custom domain for an apex whose MX belongs to another providerAbierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
voidzero-dev/void#510 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 58/100
voidzero-dev/void#509 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
voidzero-dev/void#507 ·
Los mantenedores suelen responder en 1 día
Todos los issues de voidzero-dev/void
Issues similares
-
skillopt: success-reflect prompt omits the edit schema, so every success-only edit is droppedAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Workspace secrets/constants containing "$" are corrupted when resolved in data source optionsAbiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
mobile-next/mobile-mcp#526 ·
Los mantenedores suelen responder en 1 día
-
e2e-failure ready-to-code
Dificultad 1/5 Menos de una hora Aptitud para principiantes 73/100
redhat-developer/rhdh-plugin-export-overlays#4470 · 1 comentario ·
Los mantenedores suelen responder en 1 día