Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CSS deduping and missing chunks #7218

Merged
merged 6 commits into from May 26, 2023
Merged

Fix CSS deduping and missing chunks #7218

merged 6 commits into from May 26, 2023

Conversation

bluwy
Copy link
Member

@bluwy bluwy commented May 26, 2023

Changes

Fix #6931
May also fix this issue: #7124 (cc @PxlBuzzard appreciate if you can test this after it's released)

Preface: "CSS module" here means the CSS rollup module, not CSS modules

The previous CSS deduping flow was incorrect, as it assumed a CSS module found in a SSR build applies to all pages, which isn't the case most of the time. This regression was introduced in #6582

I've fixed this by implementing a more correct CSS deduping strategy, that is to make sure SSR and client builds' generated CSS chunk ids are always derived the same way. That way the chunk name and content are always the same when written to fs.

I've put more in-code comments on how it works and why.

Testing

Added test from #6931. Made sure all other tests passed.

I'm also trying a new way to create the test, moving the new fixture code in 0-css/src/pages/client-only-and-ssr/ only. This way each new test we add are only new folders in pages/

Docs

n/a. bug fix.

@changeset-bot
Copy link

changeset-bot bot commented May 26, 2023

🦋 Changeset detected

Latest commit: caeef2f

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label May 26, 2023
@bluwy bluwy merged commit 6c7df28 into main May 26, 2023
14 checks passed
@bluwy bluwy deleted the fix-css-missing branch May 26, 2023 13:30
@astrobot-houston astrobot-houston mentioned this pull request May 26, 2023
@PxlBuzzard
Copy link

@bluwy This PR fixed it! Thank you for taking the time to find a fix for this, I appreciate it.

@bluwy
Copy link
Member Author

bluwy commented May 26, 2023

Awesome! Thanks for checking it.

bluwy referenced this pull request Jun 8, 2023
* Fix CSS chunking between multiple framework components

* Better CSS dedupe handling

* Add more tests

* Update docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Style missing when using client:only directive
3 participants