Hot reloading doesn't work with CSS-in-JS components in certain conditions #10433
Closed
7 tasks done
Labels
duplicate
This issue or pull request already exists
Describe the bug
I'm observing a strange behavior with Vite, when changes to components created with libraries like
styled-components
do not reflect in the browser, despite HMR running seemingly in a correct manner.This only happens when the
styled
component in question is exported and used elsewhere, and is colocated with any other component in the same file (See reproduction).In order to rule out a particular styling library being the culprit, I've tested this with two different libraries: Stitches and Styled Components, the behavior is exactly the same.
Reproducible in StackBlitz + Additional repository with reproduction
Reproduction
https://stackblitz.com/edit/vitejs-vite-qu9hvs?file=src%2FApp.jsx&terminal=dev
Steps to reproduce
backgroundColor
ofComponentToHotReload
to 'blue' - no changes in the browserRandomComponent
backgroundColor
ofComponentToHotReload
again - updates are reflectedSame is reproducible for Component.styled-components.jsx
Check the mentioned files for more details.
System Info
Used Package Manager
yarn
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: