Skip to content

Commit c2da435

Browse files
committed
chore: add comments
1 parent 34d0cdf commit c2da435

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

crates/rspack_plugin_rsc/src/client_plugin.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff 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)

crates/rspack_plugin_rsc/src/server_plugin.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff 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;

0 commit comments

Comments
 (0)