File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
packages/vite/src/node/plugins Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -884,9 +884,13 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin {
884884 . map ( ( chunk ) => [ chunk . preliminaryFileName , chunk . fileName ] ) ,
885885 )
886886
887- const pureCssChunkNames = [ ...pureCssChunks ] . map (
888- ( pureCssChunk ) => prelimaryNameToChunkMap [ pureCssChunk . fileName ] ,
889- )
887+ // When running in watch mode the generateBundle is called once per output format
888+ // in this case the `bundle` is not populated with the other output files
889+ // but they are still in `pureCssChunks`.
890+ // So we need to filter the names and only use those who are defined
891+ const pureCssChunkNames = [ ...pureCssChunks ]
892+ . map ( ( pureCssChunk ) => prelimaryNameToChunkMap [ pureCssChunk . fileName ] )
893+ . filter ( Boolean )
890894
891895 const replaceEmptyChunk = getEmptyChunkReplacer (
892896 pureCssChunkNames ,
You can’t perform that action at this time.
0 commit comments