Minimal reproduction for CSS missing in production builds when using export const partial = true (Astro 6.1.0+).
When a page imports a partial (with export const partial = true), and that partial imports a styled component, the component's CSS is completely missing in production builds.
- Dev mode: Works correctly ✅
- Production build (6.0.8): CSS is inlined ✅
- Production build (6.1.0+): CSS is missing ❌
src/pages/index.astro (Page)
└─ imports SearchResults
src/pages/partials/search-results/index.astro (Partial with `export const partial = true`)
└─ imports ResultsTable
src/pages/_components/ResultsTable/index.astro (Styled Component with scoped CSS)
pnpm installpnpm buildcat dist/index.htmlResult: The HTML has the scoped class data-astro-cid-b5yldnly but no CSS (no <style> tag, no CSS files).
pnpm add astro@6.0.8 --save-exact
rm -rf dist
pnpm build
cat dist/index.htmlResult: The CSS is inlined in a <style> tag ✅
The CSS from ResultsTable should be included in the production build, either:
- Inlined in a
<style>tag (like 6.0.8), or - In a separate CSS file linked in
<head>
The CSS is completely missing. The HTML has the scoped attributes but no corresponding styles.
- export const partial = true;---
import SearchResults from './partials/search-results/index.astro';
import './pages/_components/ResultsTable/index.astro'; // Force CSS bundling
---pnpm add astro@6.0.8 --save-exact