-
-
Notifications
You must be signed in to change notification settings - Fork 199
Vue HMR reloads too "much" #704
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
Comments
So, more than half a year later I discovered that this issue is still open, but I'm happy to share that I solved it by moving from the ts-loader to the babel-loader! 😃 I did need a newer version of the I made my changes available in the demo repository for everybody who is interested, on the babel branch. More specifically, it's this commit: bobvandevijver/encore-vue-hmr-test@f3becf4. The keen eye will notice that the container component also isn't required anymore, and in my experience this build method is also more than twice as fast compared with the previous method. |
This resurfaced with Webpack 5, which seems to be related to vue-loader and having source maps enabled (see vuejs/vue-loader#1795). The current workaround is to disable source maps. |
I'm having a problem with the Vue HMR functionality in combination with Webpack Encore, although I'm not sure where this issue exactly comes from: it might come from anywhere (Encore, Typescript, SFC), but at least it is not behaving as it would compared with bare Vue development, and I hope there is somebody here who can help me with it.
What do I expect
When HMR is used, changes to templates and styles should not reload the script part of the Vue SFC, resulting in the state of the page being kept. The GIF below demonstrates what I expect:
What happens?
The script part is also reloaded, resulting in the counter being reset.
Steps to reproduce
I've made a minimal reproducible example for this problem: https://github.com/bobvandevijver/encore-vue-hmr-test.
composer install && yarn install
yarn encore dev-server --hot
Test.vue
, and see the script part being reloaded as well as the counter resetsNotes
Note that I already needed to create a container component to prevent the whole page from being reloaded when the SFC is changed, and you also that component being refreshed by HMR, even though it was not touched.
Does anyone have any idea?
The text was updated successfully, but these errors were encountered: