File tree Expand file tree Collapse file tree
crates/rspack_plugin_rsc/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -188,9 +188,10 @@ fn collect_server_entry_css_files(
188188 continue ;
189189 } ;
190190
191- // Server-entry CSS blocks use the server entry resource as their request.
192- // Client component blocks use the client module request, so this lookup
193- // also filters out non-CSS blocks without walking dependencies again.
191+ // Only server CSS blocks should populate `entryCssFiles` for loadCss().
192+ // Client component blocks use the client module request here; their CSS is
193+ // recorded on `clientManifest[*].cssFiles` when recording the client module.
194+ // This lookup keeps those client component CSS files out of server entries.
194195 if entry_state
195196 . server_entries
196197 . get ( server_entry)
Original file line number Diff line number Diff line change @@ -580,6 +580,12 @@ impl RscServerPlugin {
580580 . extend ( importers) ;
581581 }
582582 entry_state. root_css_imports . extend ( root_css_imports) ;
583+
584+ // These grouped client entries are only used to shape client compiler
585+ // async blocks. They intentionally do not seed `server_entries`: CSS
586+ // imported by client components is collected from client chunks into
587+ // `clientManifest[*].cssFiles`, while `server_entries` tracks server CSS
588+ // imports and `import.meta.rspackRsc.loadCss()` data.
583589 entry_state. injected_client_entries = client_entries. clone ( ) ;
584590 entry_state. ungrouped_client_entries = ungrouped_client_entries;
585591 entry_state. root_client_entries = root_client_entries;
You can’t perform that action at this time.
0 commit comments