Skip to content

fix: hmr for inline use directive extracted virtual modules#356

Merged
lazarv merged 1 commit intomainfrom
fix/use-directive-inline-hmr
Mar 11, 2026
Merged

fix: hmr for inline use directive extracted virtual modules#356
lazarv merged 1 commit intomainfrom
fix/use-directive-inline-hmr

Conversation

@lazarv
Copy link
Copy Markdown
Owner

@lazarv lazarv commented Mar 11, 2026

Virtual modules extracted by use-directive-inline were not invalidated on file change in the client environment. Vite 8's module graph stores client-env virtual modules under root-relative paths, but the file watcher fires with absolute paths, so getModulesByFile() never found them during HMR.

Added a hotUpdate hook that tracks virtual module ids per source file, looks them up via getModuleById(), and eagerly invalidates them so stale transforms are cleared even if a downstream plugin discards the modules from the HMR update list.

@lazarv lazarv merged commit 60f8b9c into main Mar 11, 2026
99 of 100 checks passed
@lazarv lazarv deleted the fix/use-directive-inline-hmr branch March 11, 2026 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant