File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
packages/vite/src/node/plugins Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -868,6 +868,7 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin {
868868 for ( const file in bundle ) {
869869 const chunk = bundle [ file ]
870870 if ( chunk . type === 'chunk' ) {
871+ let chunkImportsPureCssChunk = false
871872 // remove pure css chunk from other chunk's imports,
872873 // and also register the emitted CSS files under the importer
873874 // chunks instead.
@@ -882,11 +883,14 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin {
882883 importedAssets . forEach ( ( file ) =>
883884 chunk . viteMetadata ! . importedAssets . add ( file ) ,
884885 )
886+ chunkImportsPureCssChunk = true
885887 return false
886888 }
887889 return true
888890 } )
889- chunk . code = replaceEmptyChunk ( chunk . code )
891+ if ( chunkImportsPureCssChunk ) {
892+ chunk . code = replaceEmptyChunk ( chunk . code )
893+ }
890894 }
891895 }
892896
You can’t perform that action at this time.
0 commit comments