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): also remove empty style chunk when cssCodeSplit: false (fixes #16582) #16585

Conversation

susnux
Copy link
Contributor

@susnux susnux commented May 3, 2024

Description

When setting cssCodeSplit: false the styles are still split into one style file, but currently the imported CSS results in empty chunks as in the current implementation empty chunks are only removed when cssCodeSplit was set to true.

So this also adds empty style chunks to pureCSSChunks even with cssCodeSplit: false.

Copy link

stackblitz bot commented May 3, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@susnux susnux changed the title fix(css): Also remove empty style chunk when cssCodeSplit: false fix(css): Also remove empty style chunk when cssCodeSplit: false (fixes #16582) May 3, 2024
@susnux susnux force-pushed the fix/also-remove-empty-chunks-without-csscodesplit branch 3 times, most recently from 456e3cd to d480b65 Compare May 3, 2024 12:51
@susnux susnux changed the title fix(css): Also remove empty style chunk when cssCodeSplit: false (fixes #16582) fix(css): also remove empty style chunk when cssCodeSplit: false (fixes #16582) May 3, 2024
Resolves vitejs#16582

When setting `cssCodeSplit: false` the styles are still split into one style file.
But currently the imported CSS results in empty chunks,
as in the current implementation empty chunks are only removed when `cssCodeSplit` was set to `true`.
So this also adds empty style chunks to `pureCSSChunks` even with `cssCodeSplit: false`.

Signed-off-by: Ferdinand Thiessen <[email protected]>
@susnux susnux force-pushed the fix/also-remove-empty-chunks-without-csscodesplit branch from d480b65 to e0a0cf3 Compare May 3, 2024 12:53
@sapphi-red
Copy link
Member

I guess this is a duplicate of #16078. Would you try if #16078 works for you?

@susnux
Copy link
Contributor Author

susnux commented May 14, 2024

@sapphi-red yes it does! And it provides tests 🚀

@susnux
Copy link
Contributor Author

susnux commented May 14, 2024

Closing in favor of #16078

@susnux susnux closed this May 14, 2024
@susnux susnux deleted the fix/also-remove-empty-chunks-without-csscodesplit branch May 14, 2024 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Non deterministic build with cssCodeSplit = false and css imports
2 participants