You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(vite-plugin): full HMR + reload matrix matching Angular CLI (#264)
Replaces the per-file node:fs.watch watcher with Vite's chokidar watcher
(server.watcher) and adds a handleHotUpdate dispatcher that mirrors the
Angular CLI HMR/reload decision matrix:
- External template (.html) change → angular:component-update (HMR)
- External style (.css) change → angular:component-update (HMR)
- Inline template/styles change → angular:component-update (HMR)
- Component class-body change (.ts) → full reload
- Plain non-component .ts change → full reload
- node_modules .ts change → pass through to Vite
Fixes a Linux-only race condition where truncate-then-write saves (used
by some AI coding tools) caused inotify to fire two discrete change events.
The first event arrived while the file was empty; pendingHmrUpdates.delete()
was called unconditionally before reading the template, consuming the pending
slot before any content could be served. The second request found no entry
and returned an empty HMR module.
Fix: move pendingHmrUpdates.delete() into the success branch (non-empty
template compiled and served) and the error/catch branch only. The
empty-file transient fallthrough preserves the entry so the subsequent
request can serve real content.
Adds unit tests covering:
- The double-request race (truncate-then-write transient empty state)
- Pending entry consumption after successful HMR
- Pending entry consumption and angular:invalidate dispatch on error
Removes truncate-then-write from the e2e write-strategy matrix — chokidar
can throttle the second inotify event on Linux making e2e coverage unreliable
for that pattern. The race condition is covered deterministically at the unit
level instead.
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
0 commit comments