New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(hmr): reload when HTML file is created/deleted #16288
Conversation
Run & review this pull request in StackBlitz Codeflow. |
/ecosystem-ci run |
📝 Ran ecosystem CI on
✅ analogjs, astro, histoire, ladle, laravel, marko, previewjs, quasar, qwik, rakkas, remix, sveltekit, unocss, vike, vite-plugin-pwa, vite-plugin-react, vite-plugin-react-pages, vite-plugin-react-swc, vite-plugin-svelte, vite-plugin-vue, vite-setup-catalogue, vitepress, vitest |
/ecosystem-ci run nuxt |
@@ -728,10 +727,13 @@ export async function _createServer( | |||
|
|||
const publicFiles = await initPublicFilesPromise | |||
|
|||
const onHMRUpdate = async (file: string, configOnly: boolean) => { | |||
const onHMRUpdate = async ( | |||
type: 'create' | 'delete' | 'update', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have an opportunity to define new names for the new hotUpdate
API, so maybe we could discuss what are the best ones here already. I'm good with create
, delete
, update
(Parcel Watcher and others use that). I imagine it is better than add
, unlink
, change
names from Chokidar? But fs.watch in node uses change
too, no?
This is a internal type for now, so I'm good with you merging it as is and we can discuss once we need to expose it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I aligned these names with the watchChange
hook.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, perfect 👍🏼
Description
When creating/deleting a HTML file, Vite now reloads the page if the page is opened. (e.g. when opening
/foo.html
andfoo.html
is created or deleted, a reload will happen)This PR also merges the HMR handling when a file is created/deleted with the HMR handling when a file is modified.
Split from #16249