vuejs / vue-router

🚦 The official router for Vue 2
http://v3.router.vuejs.org/
MIT License
18.99k stars 5.06k forks source link

Vue router reloading to '/' when used with webpack-hot-middleware #1206

Closed chopfitzroy closed 7 years ago

chopfitzroy commented 7 years ago

Vue.js / vue-router versions

2.1.2 / 2.1.1

Reproduction Link

https://github.com/CrashyBang/vue-router-reload-bug

Steps to reproduce

1) Once repo is set up run npm run src:dev and npm run app:dev and then in the app click on the Test One link.

2) Now navigate back to the code base and modify src/logic/views/TestOne.html or src/logic/views/TestOne.js now instead of inserting the new code it just vue-router is resetting to /.

3) This project was largely inspired by vuepack so there are a lot of code similarities expect in vuepack the live reloading works. It could be because I am not using the vue-loader (just vanilla JS)?

What is Expected?

Live reloading should insert new code into page and not do full reload to /

What is actually happening?

When code is modified vue-router is resetting to /

posva commented 7 years ago

t could be because I am not using the vue-loader (just vanilla JS)

Yes, more specifically vue-loader uses https://github.com/vuejs/vue-hot-reload-api which uses what allows that