Avoid full reload when CSS-like HMR is handled by another plugin#19904
Avoid full reload when CSS-like HMR is handled by another plugin#19904benpsnyder wants to merge 3 commits intotailwindlabs:mainfrom
Conversation
WalkthroughAdds a Vite dev/HMR test that scaffolds a workspace where a custom component-style-plugin rewrites src/component-wrapper.css to import Tailwind and inline src/probe.component.css, watches probe.component.css, and on updates calls environment.hot.send with type "update" for /src/component-wrapper.css while returning no module updates. A hmrWiretap logs server.ws.send and environment.hot.send payloads. The test runs pnpm vite dev --debug hmr, modifies probe.component.css (bg-blue-500 → bg-red-500), and asserts the log contains "type":"update" and not "type":"full-reload". Also updates the Tailwind Vite plugin hotUpdate hook to early-return (skip full-reload) when isPotentialCssRootFile(file) is true. 🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@integrations/vite/index.test.ts`:
- Around line 681-689: The test fixture uses __dirname inside the Vite config
which is ESM-incompatible; update the hmrWiretap path resolution in the
defineConfig block so it constructs an absolute path from import.meta.url
instead of __dirname (locate the hmrWiretap(...) call and replace the
__dirname-based resolver with one that resolves via import.meta.url, e.g.,
convert import.meta.url to a file path and then resolve 'hmr.log' from that
directory before passing to hmrWiretap).
In `@packages/`@tailwindcss-vite/src/index.ts:
- Around line 226-231: The early return on isPotentialCssRootFile(file) skips
Tailwind's watched-file invalidation; instead of returning immediately, ensure
you still invoke Tailwind's invalidation/rebuild for watched sources before
bailing out. Update the branch in the hot-update/watch handler (the block using
isPotentialCssRootFile) to call the plugin's watched-file invalidation method
(e.g., the function that currently handles scanned `@source` changes /
rebuilds—refer to the module's watched-file invalidation or rebuild function)
and only skip forcing a full-page reload; do not skip the internal
invalidate/rebuild step for the given file.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 318c5b69-eef8-4003-9fa8-1da5feae85a7
📒 Files selected for processing (2)
integrations/vite/index.test.tspackages/@tailwindcss-vite/src/index.ts
… and update HMR handling for CSS-like files to prevent unnecessary full reloads
Here is everything you need to know about this update. Please take a good look at what changed and the test results before merging this pull request. ### What changed? #### ✳️ eslint (9.30.1 → 9.32.0) · [Repo](https://github.com/eslint/eslint) · [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) <details> <summary>Release Notes</summary> <h4><a href="https://github.com/eslint/eslint/releases/tag/v9.32.0">9.32.0</a></h4> <blockquote><h2 dir="auto">Features</h2> <ul dir="auto"> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/1245000c5a81954d42f0c7eb670efe450c3bbad5"><code class="notranslate">1245000</code></a> feat: support explicit resource management in core rules (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19828">#19828</a>) (fnx)</li> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/0e957a7b5528f375a51e7c1a2fd1b03cdcd2af2d"><code class="notranslate">0e957a7</code></a> feat: support typescript types in accessor rules (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19882">#19882</a>) (fnx)</li> </ul> <h2 dir="auto">Bug Fixes</h2> <ul dir="auto"> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/960fd40dfd204af30726b49b6bec714fe49a606e"><code class="notranslate">960fd40</code></a> fix: Upgrade @eslint/js (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19971">#19971</a>) (Nicholas C. Zakas)</li> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/bbf23fa2f1c6058f6cb5c9f2f32460a15e75e596"><code class="notranslate">bbf23fa</code></a> fix: Refactor reporting into FileReport (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19877">#19877</a>) (Nicholas C. Zakas)</li> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/d4988872f375890bf677ce1a1d92a505085b51fa"><code class="notranslate">d498887</code></a> fix: bump @eslint/plugin-kit to 0.3.4 to resolve vulnerability (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19965">#19965</a>) (Milos Djermanovic)</li> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/f46fc6c137c951bc73cf3bd9446053c1b11f769b"><code class="notranslate">f46fc6c</code></a> fix: report only global references in no-implied-eval (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19932">#19932</a>) (Nitin Kumar)</li> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/7863d26b7cfb03a81ec86f93439757ff60bf6afb"><code class="notranslate">7863d26</code></a> fix: remove outdated types in <code class="notranslate">ParserOptions.ecmaFeatures</code> (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19944">#19944</a>) (ntnyq)</li> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/317330552e2d276221c7f2dd9c1516ad8b41cc3c"><code class="notranslate">3173305</code></a> fix: update execScript message in no-implied-eval rule (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19937">#19937</a>) (TKDev7)</li> </ul> <h2 dir="auto">Documentation</h2> <ul dir="auto"> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/86e7426e4463ca49ffa5c82e825ecb6aa19ca8a0"><code class="notranslate">86e7426</code></a> docs: Update README (GitHub Actions Bot)</li> </ul> <h2 dir="auto">Chores</h2> <ul dir="auto"> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/50de1ced9df2b1ee48ee6843c8cfe0f5d8edbc27"><code class="notranslate">50de1ce</code></a> chore: package.json update for @eslint/js release (Jenkins)</li> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/74f01a3f5905aaa0902837ced2425209c09c048f"><code class="notranslate">74f01a3</code></a> ci: unpin <code class="notranslate">jiti</code> to version <code class="notranslate">^2.5.1</code> (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19970">#19970</a>) (루밀LuMir)</li> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/2ab13813a7e7f3014c35490b351447ec43229951"><code class="notranslate">2ab1381</code></a> ci: pin <code class="notranslate">jiti</code> to version 2.4.2 (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19964">#19964</a>) (Francesco Trotta)</li> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/b7f75454695079f54b77fcdc9ebe3b9199d5ad30"><code class="notranslate">b7f7545</code></a> test: switch to flat config mode in <code class="notranslate">SourceCode</code> tests (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19953">#19953</a>) (Milos Djermanovic)</li> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/f5a35e3b7cee17cd31fc02c24c3e74b42ee202bc"><code class="notranslate">f5a35e3</code></a> test: switch to flat config mode in eslint-fuzzer (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19960">#19960</a>) (Milos Djermanovic)</li> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/e22af8c42d622d8d912ee7bedf49bf4283247fdc"><code class="notranslate">e22af8c</code></a> refactor: use <code class="notranslate">CustomRuleDefinitionType</code> in <code class="notranslate">JSRuleDefinition</code> (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19949">#19949</a>) (Francesco Trotta)</li> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/e85571730f1360464b7ee00695c678d551f9c643"><code class="notranslate">e855717</code></a> chore: switch performance tests to hyperfine (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19919">#19919</a>) (Francesco Trotta)</li> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/2f73a23655092a41780859ffe0a07c44a2f1b5f5"><code class="notranslate">2f73a23</code></a> test: switch to flat config mode in <code class="notranslate">ast-utils</code> tests (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19948">#19948</a>) (Milos Djermanovic)</li> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/c565a530f50c96dacd44e096f7d531b073aa4dc7"><code class="notranslate">c565a53</code></a> chore: exclude <code class="notranslate">further_reading_links.json</code> from Prettier formatting (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19943">#19943</a>) (Milos Djermanovic)</li> </ul></blockquote> <h4><a href="https://github.com/eslint/eslint/releases/tag/v9.31.0">9.31.0</a></h4> <blockquote><h2 dir="auto">Features</h2> <ul dir="auto"> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/35cf44c22e36b1554486e7a75c870e86c10b83f8"><code class="notranslate">35cf44c</code></a> feat: output full actual location in rule tester if different (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19904">#19904</a>) (ST-DDT)</li> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/a6a63259de6cb5642f69c7be429554bbcedca4c0"><code class="notranslate">a6a6325</code></a> feat: support explicit resource management in <code class="notranslate">no-loop-func</code> (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19895">#19895</a>) (Milos Djermanovic)</li> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/4682cdc6960279ee17f23899fbab6f58d881eadf"><code class="notranslate">4682cdc</code></a> feat: support explicit resource management in <code class="notranslate">no-undef-init</code> (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19894">#19894</a>) (Milos Djermanovic)</li> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/58482165eaf597cc5c58216a956c301ae87520b3"><code class="notranslate">5848216</code></a> feat: support explicit resource management in <code class="notranslate">init-declarations</code> (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19893">#19893</a>) (Milos Djermanovic)</li> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/bb370b8e79f65ee32d9d89ecf249fb74a141ad22"><code class="notranslate">bb370b8</code></a> feat: support explicit resource management in <code class="notranslate">no-const-assign</code> (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19892">#19892</a>) (Milos Djermanovic)</li> </ul> <h2 dir="auto">Bug Fixes</h2> <ul dir="auto"> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/07fac6cafa0426b4d1ea12d9001f3955f19b286d"><code class="notranslate">07fac6c</code></a> fix: retry on EMFILE when writing autofix results (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19926">#19926</a>) (TKDev7)</li> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/28cc7abbb72b29b1cac6fc4253646a7839586064"><code class="notranslate">28cc7ab</code></a> fix: Remove incorrect RuleContext types (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19910">#19910</a>) (Nicholas C. Zakas)</li> </ul> <h2 dir="auto">Documentation</h2> <ul dir="auto"> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/664cb44ab03785bd200a792607a7e20faa2d4b28"><code class="notranslate">664cb44</code></a> docs: Update README (GitHub Actions Bot)</li> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/40dbe2a43f83d366e9026faec70293512fb61ca2"><code class="notranslate">40dbe2a</code></a> docs: fix mismatch between <code class="notranslate">globalIgnores()</code> code and text (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19914">#19914</a>) (MaoShizhong)</li> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/5a0069d60815246cf24e1c96125540792c2507ef"><code class="notranslate">5a0069d</code></a> docs: Update README (GitHub Actions Bot)</li> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/fef04b5c7fea99362d67b31b8e98cd4914020ed3"><code class="notranslate">fef04b5</code></a> docs: Update working on issues info (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19902">#19902</a>) (Nicholas C. Zakas)</li> </ul> <h2 dir="auto">Chores</h2> <ul dir="auto"> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/3ddd454c1c73294e5af7905d60d03fac162f1b3e"><code class="notranslate">3ddd454</code></a> chore: upgrade to <code class="notranslate">@eslint/js@9.31.0</code> (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19935">#19935</a>) (Francesco Trotta)</li> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/d5054e5454a537e9ade238c768c262c6c592cbc1"><code class="notranslate">d5054e5</code></a> chore: package.json update for @eslint/js release (Jenkins)</li> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/0f4a3781fe7c11fad7b206c3c694655486ddd187"><code class="notranslate">0f4a378</code></a> chore: update eslint (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19933">#19933</a>) (renovate[bot])</li> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/76c2340c368f96db77439b5cd1df0196cc39bf3e"><code class="notranslate">76c2340</code></a> chore: bump mocha to v11 (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19917">#19917</a>) (루밀LuMir)</li> </ul></blockquote> <p><em>Does any of this look wrong? <a href="https://depfu.com/packages/npm/eslint/feedback">Please let us know.</a></em></p> </details> <details> <summary>Commits</summary> <p><a href="https://github.com/eslint/eslint/compare/6769b5fa11ecfb2c2cf78472d3d90564a1e01d3c...2364031090daafe34e80904c32065bfe4692d7a2">See the full diff on Github</a>. The new version differs by 37 commits:</p> <ul> <li><a href="https://github.com/eslint/eslint/commit/2364031090daafe34e80904c32065bfe4692d7a2"><code>9.32.0</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/a0e62e2739a5e214b1d371eda76f6a3b664e222a"><code>Build: changelog update for 9.32.0</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/960fd40dfd204af30726b49b6bec714fe49a606e"><code>fix: Upgrade @eslint/js (tailwindlabs#19971)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/50de1ced9df2b1ee48ee6843c8cfe0f5d8edbc27"><code>chore: package.json update for @eslint/js release</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/bbf23fa2f1c6058f6cb5c9f2f32460a15e75e596"><code>fix: Refactor reporting into FileReport (tailwindlabs#19877)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/74f01a3f5905aaa0902837ced2425209c09c048f"><code>ci: unpin `jiti` to version `^2.5.1` (tailwindlabs#19970)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/d4988872f375890bf677ce1a1d92a505085b51fa"><code>fix: bump @eslint/plugin-kit to 0.3.4 to resolve vulnerability (tailwindlabs#19965)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/2ab13813a7e7f3014c35490b351447ec43229951"><code>ci: pin `jiti` to version 2.4.2 (tailwindlabs#19964)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/b7f75454695079f54b77fcdc9ebe3b9199d5ad30"><code>test: switch to flat config mode in `SourceCode` tests (tailwindlabs#19953)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/f5a35e3b7cee17cd31fc02c24c3e74b42ee202bc"><code>test: switch to flat config mode in eslint-fuzzer (tailwindlabs#19960)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/f46fc6c137c951bc73cf3bd9446053c1b11f769b"><code>fix: report only global references in no-implied-eval (tailwindlabs#19932)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/86e7426e4463ca49ffa5c82e825ecb6aa19ca8a0"><code>docs: Update README</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/e22af8c42d622d8d912ee7bedf49bf4283247fdc"><code>refactor: use `CustomRuleDefinitionType` in `JSRuleDefinition` (tailwindlabs#19949)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/1245000c5a81954d42f0c7eb670efe450c3bbad5"><code>feat: support explicit resource management in core rules (tailwindlabs#19828)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/e85571730f1360464b7ee00695c678d551f9c643"><code>chore: switch performance tests to hyperfine (tailwindlabs#19919)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/0e957a7b5528f375a51e7c1a2fd1b03cdcd2af2d"><code>feat: support typescript types in accessor rules (tailwindlabs#19882)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/2f73a23655092a41780859ffe0a07c44a2f1b5f5"><code>test: switch to flat config mode in `ast-utils` tests (tailwindlabs#19948)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/7863d26b7cfb03a81ec86f93439757ff60bf6afb"><code>fix: remove outdated types in `ParserOptions.ecmaFeatures` (tailwindlabs#19944)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/c565a530f50c96dacd44e096f7d531b073aa4dc7"><code>chore: exclude `further_reading_links.json` from Prettier formatting (tailwindlabs#19943)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/317330552e2d276221c7f2dd9c1516ad8b41cc3c"><code>fix: update execScript message in no-implied-eval rule (tailwindlabs#19937)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/14053edc64bd378ab920575f2488fbfcbb5a4ea0"><code>9.31.0</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/2b77bd05dc50911bc97b2d2711dd75f6b5d9b9fd"><code>Build: changelog update for 9.31.0</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/3ddd454c1c73294e5af7905d60d03fac162f1b3e"><code>chore: upgrade to `@eslint/js@9.31.0` (tailwindlabs#19935)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/d5054e5454a537e9ade238c768c262c6c592cbc1"><code>chore: package.json update for @eslint/js release</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/0f4a3781fe7c11fad7b206c3c694655486ddd187"><code>chore: update eslint (tailwindlabs#19933)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/664cb44ab03785bd200a792607a7e20faa2d4b28"><code>docs: Update README</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/07fac6cafa0426b4d1ea12d9001f3955f19b286d"><code>fix: retry on EMFILE when writing autofix results (tailwindlabs#19926)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/35cf44c22e36b1554486e7a75c870e86c10b83f8"><code>feat: output full actual location in rule tester if different (tailwindlabs#19904)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/40dbe2a43f83d366e9026faec70293512fb61ca2"><code>docs: fix mismatch between `globalIgnores()` code and text (tailwindlabs#19914)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/76c2340c368f96db77439b5cd1df0196cc39bf3e"><code>chore: bump mocha to v11 (tailwindlabs#19917)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/28cc7abbb72b29b1cac6fc4253646a7839586064"><code>fix: Remove incorrect RuleContext types (tailwindlabs#19910)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/a6a63259de6cb5642f69c7be429554bbcedca4c0"><code>feat: support explicit resource management in `no-loop-func` (tailwindlabs#19895)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/4682cdc6960279ee17f23899fbab6f58d881eadf"><code>feat: support explicit resource management in `no-undef-init` (tailwindlabs#19894)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/58482165eaf597cc5c58216a956c301ae87520b3"><code>feat: support explicit resource management in `init-declarations` (tailwindlabs#19893)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/bb370b8e79f65ee32d9d89ecf249fb74a141ad22"><code>feat: support explicit resource management in `no-const-assign` (tailwindlabs#19892)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/5a0069d60815246cf24e1c96125540792c2507ef"><code>docs: Update README</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/fef04b5c7fea99362d67b31b8e98cd4914020ed3"><code>docs: Update working on issues info (tailwindlabs#19902)</code></a></li> </ul> </details> ---  [Depfu](https://depfu.com) will automatically keep this PR conflict-free, as long as you don't add any commits to this branch yourself. You can also trigger a rebase manually by commenting with `@depfu rebase`. <details><summary>All Depfu comment commands</summary> <blockquote><dl> <dt>@depfu rebase</dt><dd>Rebases against your default branch and redoes this update</dd> <dt>@depfu recreate</dt><dd>Recreates this PR, overwriting any edits that you've made to it</dd> <dt>@depfu merge</dt><dd>Merges this PR once your tests are passing and conflicts are resolved</dd> <dt>@depfu cancel merge</dt><dd>Cancels automatic merging of this PR</dd> <dt>@depfu close</dt><dd>Closes this PR and deletes the branch</dd> <dt>@depfu reopen</dt><dd>Restores the branch and reopens this PR (if it's closed)</dd> <dt>@depfu pause</dt><dd>Ignores all future updates for this dependency and closes this PR</dd> <dt>@depfu pause [minor|major]</dt><dd>Ignores all future minor/major updates for this dependency and closes this PR</dd> <dt>@depfu resume</dt><dd>Future versions of this dependency will create PRs again (leaves this PR as is)</dd> </dl></blockquote> </details> Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com>
| // CSS-like files may still be handled by another plugin's stylesheet | ||
| // HMR pipeline even when the module graph only exposes asset-like | ||
| // placeholder modules during this pass. We still need to invalidate | ||
| // the watched modules so Tailwind rebuilds, but we should not force | ||
| // a full page reload that can race against a later targeted | ||
| // css-update payload. | ||
| if (isPotentialCssRootFile(file)) { | ||
| return [] | ||
| } | ||
|
|
There was a problem hiding this comment.
The test is passing (good!), but getting rid of this code doesn't fail the integration test, so either the test is not testing what it's supposed to test, or this isn't the actual fix.
Summary
Fixes the
@tailwindcss/viteHMR fallback that was forcing a full page reload for CSS-like watched files even when another plugin was already handling the stylesheet update.Cross-References
Repro Shape
@tailwindcss/vitefull-reload, then latercss-updateRoot Cause
@tailwindcss/vitesees the changed stylesheet as an external watched filehotUpdate(...)fallback sendsfull-reloadcss-updatefor the same editFix
The change in
packages/@tailwindcss-vite/src/index.tsnarrows the external-file reload fallback:full-reloadpathRegression Coverage
The integration test covers the reproduced handoff pattern:
"type":"update""type":"full-reload"postcssTest Plan