Skip to content

Commit 59cd518

Browse files
committed
Prevent empty CSS chunks from being written to disk
1 parent 7794452 commit 59cd518

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

packages/astro/src/core/build/plugins/plugin-css.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,13 @@ function rollupPluginAstroBuildCSS(options: PluginOptions): VitePlugin[] {
204204
)
205205
return;
206206

207+
// Delete empty CSS chunks. In prerender these are likely duplicates
208+
// from SSR.
209+
if(stylesheet.source.length === 0) {
210+
delete bundle[id];
211+
return;
212+
}
213+
207214
const toBeInlined =
208215
inlineConfig === 'always'
209216
? true

0 commit comments

Comments
 (0)