-
-
Notifications
You must be signed in to change notification settings - Fork 8k
import.meta.hot.accept callback attempts to destructure undefined when changed file contains errors #8625
Copy link
Copy link
Closed
Labels
p2-nice-to-haveNot breaking anything but nice to have (priority)Not breaking anything but nice to have (priority)
Description
Describe the bug
- Start up a Vite + Vue3 app
- Open the browser dev tools and observe the console
- Introduce a syntax error into a SFC. For example, change
importtoimportasdfinApp.vue - Observe two expected errors
- GET ... ERR_ABORTED 404
- [hmr] Failed to reload /src/App.vue. ...
- Observe an additional, unexpected error due to hot.accept trying to destructure
undefined. See logs below.
Either
vite/packages/vite/src/client/client.ts
Line 440 in 0e5c009
| acceptDeps([ownerPath], ([mod]) => deps && deps(mod)) |
deps if mod is undefined, or vite/packages/plugin-vue/src/main.ts
Line 131 in ccfccec
| `import.meta.hot.accept(({ default: updated, _rerender_only }) => {`, |
undefined.
Reproduction
https://vite.new/vue-ts
System Info
(--system omitted - running within Stackblitz)
Binaries:
Node: 16.14.2 - /usr/local/bin/node
Yarn: 1.22.10 - /bin/yarn
npm: 7.17.0 - /bin/npm
npmPackages:
@vitejs/plugin-vue: ^2.3.3 => 2.3.3
vite: ^2.9.12 => 2.9.12Used Package Manager
npm
Logs
Uncaught (in promise) TypeError: Cannot destructure property 'default' of 'undefined' as it is undefined.
at App.vue:45:36
at client:519:60
at client:461:13
at client:350:60
at Array.forEach (<anonymous>)
at queueUpdate (client:350:38)Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- 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 https://github.com/vuejs/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
p2-nice-to-haveNot breaking anything but nice to have (priority)Not breaking anything but nice to have (priority)