-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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 chunking between multiple framework components #6582
Conversation
🦋 Changeset detectedLatest commit: 54f9616 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 |
This comment was marked as outdated.
This comment was marked as outdated.
// In the client build, we bail if the chunk is a duplicated CSS chunk tracked from | ||
// above. We remove all the importedCss to prevent emitting the CSS asset. | ||
if (options.target === 'client') { | ||
if (Object.keys(c.modules).every((id) => internals.cssChunkModuleIds.has(id))) { | ||
for (const importedCssImport of meta.importedCss) { | ||
delete bundle[importedCssImport]; | ||
meta.importedCss.delete(importedCssImport); | ||
} | ||
return; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This block is removed in favour of the transform()
hook, which does the same thing, and should be safer.
Changes
Fix #6524
Fix #6395
When we use
manualChunks
to give a name for CSS chunks, we based on all the parent top-level.astro
page related to that CSS chunk to create a name and hash.However, for CSS chunks during the client build, where the build inputs are the framework components, it's not possible to do so. This PR skips the custom chunk handling for client builds.
But the above change indirectly regresses #4566, so I fixed it by changing our CSS dedupe handling in a
transform()
hook instead ofrenderChunk()
.Testing
Added a test based on both issue repros, also updated some tests due to new chunking behaviour.
Docs
n/a. bug fix.