fix: monkey-patch Vite HMR issue & make it reproducible (#464) #496
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Surely, I understand that this is not the best way to fix HMR, and original problem probably lies closer to Vite itself. But this at least makes tailwind usable when Vite breaks, without waiting for upstream fixes.
You can run the playground and edit some styles there, which will result in following HMR events:
HMR events
event 1 (emitted by fix):
event 2 (emitted by Vite):
Vite event is completely missing any style reload, and disabling the fix will indeed break HMR. Also, config options is provided to switch the fix off if it will break anything some time.
(i'm also not sure what to do with huge
yarn.lock
diff consisting primarily of shuffled lines)