You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Vite Vue 3 project, dev mode! This issue could be related to vite client (that manages hot updates on the page).
When updating comments in the template section of an .vue SFC, the comments are not correctly HMRed. Only on a page refresh, the updated comments are rendered correctly.
Steps to reproduce:
In the stackblitz reproduction link, in terminal (if not auto-started), npm run dev to serve the vite app. Open App.vue.
We need to inspect the console > elements tab of the rendered app, so in stackblitz, click on "Open in New Window" button which is found on the top right. This will open the app in an external window. In this external window, please open the console > elements tab.
You can see the:
Now, back in the editor, paste the below in the middle of template content:
Check console in the external window. HMR did not update the newly added comments, and has weirdly duplicated the comments from the "bottom" portion elements. Even if you save (cmd+s on editor window), the content stays as it is.
Now, refresh the external window. The updated comments are now rendered correctly.
Now, again, in editor, select the previously pasted code (from step 4 above), delete it.
Check console in the external window. HMR again weirdly removed the comments from the "bottom" portion and not the "middle" portion that we just deleted from the template.
To summarise, continuous HMR messes up the comments in the rendered app. I couldn't speculate as to why this is happening.
Some additional observations (Webpack):
I tested the above with Vue-cli-5.0.0-rc.2 based Vue-3 project. Comments were perfectly HMRed. No mess up.
I tested the above with Vue-cli-4 based Vue-2 project (template tag should open as <template comments>). Comments were perfectly HMRed. No mess up.
Comments in templates are quite critical during development and the above is a very very simplistic reproduction. Comments are quite often used during troubleshooting complex apps eg:vuejs/vue#6150 (searching the rendered app's console > elements tab), and has great capability to be leveraged in external tooling integrations (I'm working on one).
I believe this is an HMR issue, but if it's in fact vue-core issue, please let me know, I can log it there.
Please kindly look into this. Vite is super fast, and would love to see HMR perfected :-) Thanks a lot for the magic.
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.
Describe the bug
Vite Vue 3 project, dev mode! This issue could be related to vite client (that manages hot updates on the page).
When updating comments in the template section of an .vue SFC, the comments are not correctly HMRed. Only on a page refresh, the updated comments are rendered correctly.
Steps to reproduce:
In the stackblitz reproduction link, in terminal (if not auto-started),
npm run dev
to serve the vite app. Open App.vue.We need to inspect the console > elements tab of the rendered app, so in stackblitz, click on "Open in New Window" button which is found on the top right. This will open the app in an external window. In this external window, please open the console > elements tab.
You can see the:
Now, back in the editor, paste the below in the middle of template content:
Some additional observations (Webpack):
<template comments>
). Comments were perfectly HMRed. No mess up.Comments in templates are quite critical during development and the above is a very very simplistic reproduction. Comments are quite often used during troubleshooting complex apps eg:vuejs/vue#6150 (searching the rendered app's console > elements tab), and has great capability to be leveraged in external tooling integrations (I'm working on one).
I believe this is an HMR issue, but if it's in fact vue-core issue, please let me know, I can log it there.
Please kindly look into this. Vite is super fast, and would love to see HMR perfected :-) Thanks a lot for the magic.
Reproduction
https://stackblitz.com/edit/vitejs-vite-mwwa3m?file=src/App.vue
System Info
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: