Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/vite/src/node/plugins/css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,7 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin {
for (const file in bundle) {
const chunk = bundle[file]
if (chunk.type === 'chunk') {
let chunkImportsPureCssChunk = false
// remove pure css chunk from other chunk's imports,
// and also register the emitted CSS files under the importer
// chunks instead.
Expand All @@ -874,11 +875,14 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin {
importedAssets.forEach((file) =>
chunk.viteMetadata!.importedAssets.add(file),
)
chunkImportsPureCssChunk = true
return false
}
return true
})
chunk.code = replaceEmptyChunk(chunk.code)
if (chunkImportsPureCssChunk) {
chunk.code = replaceEmptyChunk(chunk.code)
}
}
}

Expand Down