Repository navigation
Description
Tracking
| Item | Link |
|---|---|
| Framework-side investigation and repro harness | analogjs/analog#2226 (comment) |
| Proposed upstream fix | #19904 |
Environment
| Question | Answer |
|---|---|
| Tailwind version | @tailwindcss/vite v4.2.2 |
| Build tool / framework | Analog.js on Vite 8.0.3 with Angular 21 component stylesheets |
| Node.js | v25.8.2 locally for investigation |
| Browser | Chrome |
| Operating system | macOS |
Reproduction
| Item | Value |
|---|---|
| Public repro | Branch-based repro harness: https://github.com/benpsnyder/analog/tree/fix/tailwind |
| Private repro characteristics | Vite 8, @tailwindcss/vite 4.2.2, Analog.js / Angular component stylesheet HMR |
| Trigger | edit a component .css file |
| Actual result | targeted css-update is preceded by an earlier full-reload |
| Expected result | no full page reload when a later plugin can handle the stylesheet through CSS HMR |
Manual branch-based repro:
git clone https://github.com/benpsnyder/analog.git
cd analog
git checkout fix/tailwind
pnpm install
pnpm exec nx serve tailwind-debug-appThen edit apps/tailwind-debug-app/src/app/probes/style-probe.component.css and watch the captured HMR traffic in tmp/debug/tailwind-debug-app.vite-ws.log. On the failing path described here, the stylesheet save emits {"type":"full-reload"} before the later css-update payload(s).
Problem Statement
@tailwindcss/vite is forcing a full page reload for an Angular component stylesheet edit even though another plugin later handles the same file with targeted CSS HMR.
Investigation Summary
| Signal | Finding |
|---|---|
| Outbound HMR payloads | full-reload is emitted before the later CSS HMR updates |
| Filesystem timing | only the component stylesheet changes in the relevant save window |
| Angular/Analog diagnostics | the framework-side stylesheet path reports css-update, not reload fallback |
| Sender stack | the full-reload originates in @tailwindcss/vite |
Evidence
App-side Vite wiretap
for (const [environmentName, environment] of Object.entries(server.environments)) {
const originalHotSend = environment.hot.send.bind(environment.hot)
environment.hot.send = ((payload: unknown) => {
const stack =
typeof payload === 'object' &&
payload !== null &&
'type' in payload &&
(payload as { type?: unknown }).type === 'full-reload'
? new Error(`[Adastra ENV HOT] ${environmentName} full-reload`).stack
: undefined
writeLog(wsLogPath, {
environmentName,
payload,
source: 'environment.hot.send',
stack,
})
return originalHotSend(payload as never)
}) as typeof environment.hot.send
}Captured sender stack
Error: [Adastra ENV HOT] client full-reload
at Object.send (...vite.config.mts...mjs:101:136)
at MinimalPluginContext.hotUpdate (.../@tailwindcss/vite/dist/index.mjs:1:3436)
at handleHMRUpdate (.../vite/dist/node/chunks/node.js:26576:67)
at onHMRUpdate (.../vite/dist/node/chunks/node.js:26113:41)
at FSWatcher.<anonymous> (.../vite/dist/node/chunks/node.js:26138:9)HMR sequence for one stylesheet save
| Order | Event |
|---|---|
| 1 | {"type":"full-reload"} from environment.hot.send |
| 2 | browser receives full-reload |
| 3 | browser then receives update payload(s) containing css-update |
Representative log excerpt:
2026-04-05T00:14:55.220Z {"environmentName":"client","payload":{"type":"full-reload"},"source":"environment.hot.send", ...}
2026-04-05T00:14:55.220Z {"type":"full-reload"}
2026-04-05T00:14:55.227Z {"environmentName":"client","payload":{"type":"update","updates":[{"type":"css-update", ...}]}}
2026-04-05T00:14:55.228Z {"environmentName":"client","payload":{"type":"update","updates":[{"type":"css-update", ...}]}}File-level evidence
| Observation | Value |
|---|---|
| changed file | call-to-action.component.css |
| generated route files in same save window | none observed |
| conclusion | the reload is not being triggered by route generation or another generated application file |
Relevant Tailwind code path
let isExternalFile =
modules.length > 0 &&
modules.every((mod) => mod.type === 'asset' || mod.id === undefined)
if (!isExternalFile) return
if (!isScannedFile(file, modules, roots)) {
continue
}
if (env === this.environment.name) {
this.environment.hot.send({ type: 'full-reload' })
} else if (server.hot.send) {
server.hot.send({ type: 'full-reload' })
} else if (server.ws.send) {
server.ws.send({ type: 'full-reload' })
}Why This Looks Upstream
| Observation | Why it matters |
|---|---|
| Tailwind treats asset-only / missing-id modules as evidence that no plugin handles the file | that assumption is false for this Angular component stylesheet pipeline |
Analog later emits a valid css-update for the same file |
proves the file is still in a handled stylesheet HMR path |
Analog diagnostics report outcome: 'css-update' |
the framework-side branch is not choosing reload as the preferred result |
Framework-side references:
Representative Analog diagnostic:
analog:angular:hmr:v component stylesheet hmr outcome {
file: '.../call-to-action.component.css',
outcome: 'css-update',
encapsulation: 'emulated',
preferredPath: 'css-update',
pitfalls: ['tracked-wrapper-missing-from-module-graph', 'no-owner-modules']
}Expected vs Actual
| Expected | Actual | |
|---|---|---|
| Angular component stylesheet edit | preserve targeted CSS HMR when another plugin can handle it | immediate full-reload from @tailwindcss/vite, then later css-update |
Likely Fix Direction
| Direction | Reason |
|---|---|
narrow the isExternalFile full-reload branch |
reserve reloads for true non-module scanned files like HTML / PHP / template changes |
avoid forcing full-reload for CSS source files solely because modules are asset-only / missing-id |
CSS-like files may still be handled by another plugin's stylesheet HMR pipeline |
If useful, I can follow up with a minimal public reproduction repo and a proposed patch.
Reacted by Bhoomika Olbert, lady-sarno, Miro Solanka, strazi and Peter
Reacted by Syed Abdullah Yaqoob
Reacted by Haruto Leisure
Metadata
Metadata
Assignees
Labels
No labels
Activity
benpsnyder commentedon Apr 5, 2026
@RobinMalfait I spent a 12 hour day re-writing Analog's stylesheet processing pipeline and HMR, used
obugand wrote an extensive scoped debug capability (you can see it in recent closed PR's in analog's repo). Climbed through the depths of hell to pinpoint exactly what needs to be fixed here upstream. Thank you!beanscg commentedon Jun 9, 2026
neemski commentedon Jul 6, 2026
FWIW I'm hitting what appears to be the same fallback, but with plain
.tsxfiles (no CSS-like files involved) so the fix direction in #19904 (exempting CSS-like files) would not have covered our case. We've worked around this by applying a patch that also exempts files that resolve to JS modules.Adding some more context from Claude if this helps:
Environment
@tailwindcss/vite@vitejs/plugin-react-swc4.3.0Symptom
Editing any
.tsxfile that Tailwind scans for class candidates produces a successful HMR update, followed ~20ms later by a{"type":"full-reload"}payload, so every component edit turns into a full page reload. The dev server terminal logs only thehmr updateline, neverpage reload, because the payload is sent directly viahot.sendfrom the plugin'shotUpdatehook, bypassing Vite's logger.Evidence
Running
window.addEventListener('beforeunload', () => { debugger; }, true)in the console shows the reload originating from the Vite client'scase "full-reload":handler (handleMessage→pageReload()). The sender is the same code path quoted in this issue:In Vite 8, this guard passes for ordinary
.tsxsource files in a non-client environment, and since every.tsxcontaining class candidates is a scanned file,isScannedFilereturns true and the reload fires on every component edit. Notably, files without Tailwind class candidates hot-reload fine — which matches the scanned-file registry being the discriminator. The client environment handles the same edit correctly (JS update + regenerated CSS through the normal watch-dependency path), so the reload is pure collateral.Disabling the
tailwindcss()plugin makes HMR behave perfectly (minus CSS generation, of course), confirming the sender.Workaround we're shipping
A package patch that early-returns from
hotUpdatefor/\.[cm]?[jt]sx?(\?.*)?$/files. With it, component HMR works and newly introduced utility classes still apply live via the normalcss-updatepath.This suggests the fix should exempt any file that resolves to a real JS module, or restrict the fallback to true non-module content files (HTML/PHP templates), rather than only exempting CSS-like files.
RobinMalfait commentedon Jul 7, 2026
@neemski can you open a separate issue with a minimal reproduction repo attached so we can tackle that separately?
neemski commentedon Jul 9, 2026
@RobinMalfait separate issue with a minimal repro-repo filed here: #20320
RobinMalfait commentedon Jul 15, 2026
Hey! This should be fixed by #20336, and will be available in the next release.
You can already try it by using the insiders build:
CLI:
PostCSS:
Vite:
webpack:
Don't trigger a full page reload for scanned files that Vite processe…
Do not force full page reloads when using `@tailwindcss/vite` (#20414)