docs: More robust solution to Safari dev cache bug #476
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.
Description 📖
Safari had an annoying bug where it will ignore changes to CSS files, breaking the developer's hot-reload experience. The Vite Ruby troubleshooting guide recommends moving CSS into the JS entrypoint as a workaround.
However, in Safari 17.5, the problem is now even worse: the bug now affects JS files as well. That means the previously documented workaround is no longer a solution for the entire scope of Safari HMR issues.
Background 📜
Ultimately, the problem is a known bug in Safari where it aggressively caches JS and CSS files that are marked
rel=preload
.https://bugs.webkit.org/show_bug.cgi?id=193533
The Fix 🔨
Update the Vite Ruby troubleshooting guide with a more robust workaround: disable the
rel=preload
Link header in development. This completely solves the issue for me.FWIW, I'm running:
macOS 14.5 (23F79)
Safari 17.5 (19618.2.12.11.6)