### Related plugins - [x] [plugin-vue](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue) - [ ] [plugin-vue-jsx](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue-jsx) ### Describe the bug Hot reload "fails" under a certain condition: Consider the Vue component hierarchy ``` App - Outer - Inner ``` Both `Outer` and `Inner` imports a file `service.js`. When running with `npm run dev`, editing that file triggers hot reload which logs the following warning and error: ``` [Vue warn]: Unhandled error during execution of scheduler flush at <Inner> at <Outer> at <App> runtime-core.esm-bundler.js:51:12 Uncaught (in promise) TypeError: parent is null ... ``` Besides the error being logged, I didn't observe anything actually breaking. Reproduced in Firefox and Chrome on macOS. **SSCCE** Based on scaffolding using `npm create vite@latest`. `main.js` ``` import App from './App.vue'; import { createApp } from 'vue'; createApp(App) .mount('#app'); ``` `App.vue` ```vue import App from './App.vue'; import { createApp } from 'vue'; createApp(App) .mount('#app'); ``` `Outer.vue` ```vue <script setup> import './service.js'; import Inner from './Inner.vue'; </script> <template> <Inner/> </template> ``` `Inner.vue` ```vue <script setup> import './service.js'; </script> <template> Contents... </template> ``` `service.js`: *Anything...* ### Reproduction https://github.com/bisgardo/vue-vite-hotreload-bug-example ### Steps to reproduce 1. Run `npm run dev` 2. Make any edit to `service.js`. 3. Observe warning and error being dumped in the Browser's console. ### System Info ```shell System: OS: macOS 15.5 CPU: (11) arm64 Apple M3 Pro Memory: 126.92 MB / 36.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 22.9.0 - ~/.asdf/installs/nodejs/22.9.0/bin/node npm: 10.8.3 - ~/.asdf/installs/nodejs/22.9.0/bin/npm Browsers: Chrome: 137.0.7151.69 Safari: 18.5 npmPackages: @vitejs/plugin-vue: 5.2.4 => 5.2.4 vite: 6.3.5 => 6.3.5 ``` ### Used Package Manager npm ### Logs ``` [Vue warn]: Unhandled error during execution of scheduler flush at <Inner> at <Outer> at <App> runtime-core.esm-bundler.js:51:12 Uncaught (in promise) TypeError: parent is null insert runtime-dom.esm-bundler.js:28 processText runtime-core.esm-bundler.js:4774 patch runtime-core.esm-bundler.js:4688 componentUpdateFn runtime-core.esm-bundler.js:5353 run reactivity.esm-bundler.js:237 setupRenderEffect runtime-core.esm-bundler.js:5481 mountComponent runtime-core.esm-bundler.js:5256 processComponent runtime-core.esm-bundler.js:5209 patch runtime-core.esm-bundler.js:4727 componentUpdateFn runtime-core.esm-bundler.js:5433 run reactivity.esm-bundler.js:227 reload runtime-core.esm-bundler.js:529 callWithErrorHandling runtime-core.esm-bundler.js:199 flushJobs runtime-core.esm-bundler.js:408 promise callback*queueFlush runtime-core.esm-bundler.js:322 ``` ### Validations - [x] Follow our [Code of Conduct](https://github.com/vitejs/vite/blob/main/CODE_OF_CONDUCT.md) - [x] Read the [Contributing Guidelines](https://github.com/vitejs/vite/blob/main/CONTRIBUTING.md). - [x] Read the [docs](https://vitejs.dev/guide). - [x] Check that there isn't [already an issue](https://github.com/vitejs/vite-plugin-vue/issues) that reports the same bug to avoid creating a duplicate. - [x] Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to [vuejs/core](https://github.com/vuejs/core) instead. - [x] Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/vitejs/vite-plugin-vue/discussions) or join our [Discord Chat Server](https://chat.vitejs.dev/). - [x] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.