File tree 1 file changed +13
-4
lines changed
packages/vite/src/node/plugins 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -640,10 +640,19 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin {
640
640
641
641
async renderChunk ( code , chunk , opts , meta ) {
642
642
let chunkCSS = ''
643
- const renderedModules = Object . fromEntries (
644
- Object . values ( meta . chunks ) . flatMap ( ( chunk ) =>
645
- Object . entries ( chunk . modules ) ,
646
- ) ,
643
+ const renderedModules = new Proxy (
644
+ { } as Record < string , RenderedModule | undefined > ,
645
+ {
646
+ get ( _target , p ) {
647
+ for ( const name in meta . chunks ) {
648
+ const modules = meta . chunks [ name ] . modules
649
+ const module = modules [ p as string ]
650
+ if ( module ) {
651
+ return module
652
+ }
653
+ }
654
+ } ,
655
+ } ,
647
656
)
648
657
// the chunk is empty if it's a dynamic entry chunk that only contains a CSS import
649
658
const isJsChunkEmpty = code === '' && ! chunk . isEntry
You can’t perform that action at this time.
0 commit comments