-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Prevent ?inline and ?raw CSS from being bundled as CSS #6161
Conversation
🦋 Changeset detectedLatest commit: b429a8a 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 |
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.
Was about to suggest the incorrect regex test, but that's fixed now. LGTM once the tests pass.
Also, according to the issue, is this still a Vite bug? I don't think Vite is removing pure css chunks for ?inline
🤔
Also, I noticed the cssRe
check can be replaced with import { isCSSRequest } from 'vite'
since Vite 4.0. We could clean that up here, or I'm fine tackling that in a separate PR too.
@bluwy does the vite version of This could technically happen in Vite but it would require that an |
Looks like the |
Ah I see. So what happened before is that all types of CSS imports are combined as a CSS chunk, even if they're not really CSS like for |
Yep, that's exactly right. I can't think of a scenario where this would happen in regular Vite without someone manipulating manualChunks like we were. In this case the manualChunks part is the error, we don't actually want this type of CSS in that same chunk. If it were it would prevent it from being split into a CSS file! |
@matthewp It seems like styles imported with the I noticed this behavior began with Astro 2.0.7. Is that intended? |
Seems like a bug to me. Feel free to open an issue so we can track it. It could also likely be a Vite bug but I'm not sure yet. |
Changes
Testing
?inline
and?raw
usage.Docs
N/A, bug fix