File tree 1 file changed +7
-3
lines changed
packages/vite/src/node/plugins 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 {
884
884
. map ( ( chunk ) => [ chunk . preliminaryFileName , chunk . fileName ] ) ,
885
885
)
886
886
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 )
890
894
891
895
const replaceEmptyChunk = getEmptyChunkReplacer (
892
896
pureCssChunkNames ,
You can’t perform that action at this time.
0 commit comments