-
-
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 duplicate CSS in dev
mode
#4157
Conversation
🦋 Changeset detectedLatest commit: 29baf0c The changes in this PR will be included in the next version bump. This PR includes changesets to release 12 packages
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.
LGTM. I'd love to see a simpler solution if you think one exists, but only if it's a light lift. Otherwise, this is more than enough heading into a great v1.0 release!
@natemoo-re Any chance this made it's way back into dev mode? I'm experiencing duplicate css when using the following in an astro file:
|
I'm also seeing this when importing scss modules into React components. E.g. import styles from './navigation.module.scss'; They appear to be duplicated between inline and the original file |
Changes
dev
, Vite treats all.css
files as JS modules that inject themselves into the page.astro dev
.client/hmr
logic that removes any SSR'd styles as soon as the HMR styles are present on the client. No more duplicates!data-astro-injected
attribute because it's no longer needed!Testing
Tests using
data-astro-injected
updated. HMR already covered by existing tests.Docs
N/A