Skip to content
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

Merged
merged 4 commits into from Mar 27, 2024

Conversation

sapphi-red
Copy link
Member

Description

When creating/deleting a HTML file, Vite now reloads the page if the page is opened. (e.g. when opening /foo.html and foo.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

@sapphi-red sapphi-red added feat: hmr p2-nice-to-have Not breaking anything but nice to have (priority) labels Mar 27, 2024
Copy link

stackblitz bot commented Mar 27, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@patak-dev
Copy link
Member

/ecosystem-ci run

@patak-dev
Copy link
Member

/ecosystem-ci run nuxt

@vite-ecosystem-ci
Copy link

📝 Ran ecosystem CI on 635188e: Open

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',
Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, perfect 👍🏼

@patak-dev patak-dev merged commit 1f53796 into vitejs:main Mar 27, 2024
10 checks passed
@sapphi-red sapphi-red deleted the refactor/hmr-handle2 branch March 27, 2024 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat: hmr p2-nice-to-have Not breaking anything but nice to have (priority)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants