No description
# PR: Fix @source file changes not triggering full page reload on Vite 7.1+ ## Description This PR addresses issue #19637 where template files (PHP, HTML, Blade, etc.) watched via the `@source` directive fail to trigger a full page reload when using Vite 7.1 or newer. ## Root Cause Vite 7.1 introduced the Environment API, which supersedes the legacy WebSocket API for HMR. Specifically: - `server.ws.send` is deprecated/ignored for certain external file updates in favor of `server.hot.send`. - The `@tailwindcss/vite` plugin currently collects `ViteDevServer` instances but lacks a `handleHotUpdate` hook to explicitly trigger reloads for non-module files added via `addWatchFile`. ## Changes - Implemented a `handleHotUpdate` hook in the `@tailwindcss/vite` plugin. - The hook identifies changes to files that are not part of the standard Vite module graph (e.g., `.php`, `.html`) but are watched by Tailwind. - Triggers a `full-reload` using the new `server.hot.send` API if available (Vite 7.1+), with a fallback to `server.ws.send` for backward compatibility. ## Verification - Reproduced the issue in a standalone Vite 7.1.0 project using a mock plugin with the legacy API. - Confirmed that the browser fails to reload upon editing a watched `.php` file. - Verified that migrating to `server.hot.send` restores the expected reload behavior. [ci-all] --------- Co-authored-by: Robin Malfait <malfait.robin@gmail.com> |
||
|---|---|---|
| .github | ||
| crates | ||
| integrations | ||
| packages | ||
| patches | ||
| playgrounds | ||
| scripts | ||
| .gitignore | ||
| .prettierignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| CHANGELOG.md | ||
| LICENSE | ||
| package.json | ||
| pnpm-lock.yaml | ||
| pnpm-workspace.yaml | ||
| README.md | ||
| rust-toolchain.toml | ||
| turbo.json | ||
| vitest.config.ts | ||
A utility-first CSS framework for rapidly building custom user interfaces.
Documentation
For full documentation, visit tailwindcss.com.
Community
For help, discussion about best practices, or feature ideas:
Discuss Tailwind CSS on GitHub
Contributing
If you're interested in contributing to Tailwind CSS, please read our contributing docs before submitting a pull request.