-
Notifications
You must be signed in to change notification settings - Fork 27.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify server CSS handling (#51018)
Remove the Server CSS manifest and related logic, and use the chunkGroup CSS files instead for each entry to inject stylesheet links. Why was that manifest needed in the first place? When implementing CSS collection for RSC and nested layout initially, we collect CSS imports at each layer and create corresponding client entries. But then soon got hit by the problem of duplication and improper tree-shaking. Two layers can have the same CSS imported so we solved it in a way that "if an upper layer imports this module, skip it in child layers". Note that this is deduped by module, so we need to keep the information of "layer (entry) → CSS modules" somewhere, in a manifest. Another reason is that we create the client entry before Webpack optimizes modules, so we can inject the client entry into the same compilation. But that means the collected client modules from the server layer are not properly optimized (DCE). **This is a general issue at the moment that's not specifically related to CSS, although using that manifest to collect DCE'd info and join the original collected CSS files with that info temporarily solved it.** That's why I disabled some tests related to font CSS collection and want to improve it in a more general way. Why is that not needed anymore? Main reason is to keep a good balance between duplication and number of chunks, and delegate the decision to Webpack's splitChunks plugin. It is not possible to get to a point of 0 duplication unless we ship every CSS module as a single chunk. And since in #50406 we made the duplication better but at the chunk asset level, instead of the original module level. Prior work: #50406, #50610.
- Loading branch information
Showing
21 changed files
with
117 additions
and
341 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.