Vue-loader: vue-router subroutes has bug with vue-hot-module-replacement

Created on 4 May 2016  Â·  22Comments  Â·  Source: vuejs/vue-loader

demo: https://github.com/GilbertSun/vue-debug-demo

repeat:
1.

npm install && npm run dev
  1. open browser navigate http://localhost:8080
  2. change ./src/index.vue
<template>
    <div>
        <header>i am header</header>
        <main>
            <router-view></router-view>
        </main>
    </div>
</template>

to

<template>
    <div>
        <header>i am header change</header>
        <main>
            <router-view></router-view>
        </main>
    </div>
</template>

it will apply hot module replacement

i got the result

image

dom structure is

image

it looks like hmr inject the whole app into a sub router-view

ps: i'm not sure this is a vue-loader bug, but in the https://github.com/vuejs/vue-router/tree/dev/example/advanced this bug didn't appear, so i think this bug may the difference version in vue-loader or vue-hot-reload-api

bug 8.x

Most helpful comment

+1 Still in 2017

All 22 comments

i init this project with vue init webpack-simple

same problem

I have similar problem.
I start with vue init webpack and set up the nested routes.

the only problem is when I made change on parent route. always duplicating content component every times changes happen.

vue-router and hmr issue

+1 Also with this problem... It's cascading the Parent into the Parent's router-view. :(

Edit: I'm using browserify + hmr

+1 same problem
but when I locked vue loader version ~8.3.1, it seems everything working fine

Also having this problem. Downgrading vue-loader to 8.3.1 didn't do it for me. Which version of vue-hot-reload-api are you using?

@rjoo vue-hot-reload-api's version is 1.3.2, but I found in another project this problem still existed
@yyx990803 can you solve it?

Same Problem. Searching for some solutions.

@antoniputra Sorry for mentioning you in an old issue, have you solved this problem?

@zheeeng not yet :(
I don't have any idea how to solve it.

because this is in development environment, I just skip, and continue my development.

@antoniputra I also have to skip this problem and perform the page refreshing manually.

  • -。 +1

+1 pain

+1
In the https://github.com/vuejs/vue-router/tree/dev/example/advanced is normal, but I found the console output:

[HMR] Vue component hot reload shim applied.
[HMR] vue-router <router-view> hot reload shim applied.

When this bug present, the console only print

[HMR] Vue component hot reload shim applied.

seems <router-view> hot reload shim applied not applied.

I can reproduce the problem in the following situation:

<!-- HMR won't work -->
<router-link :to="{ name: 'home' }">
    <span>Home!</span>
</router-link>

<!-- HMR works -->
<router-link :to="{ name: 'home' }">
    Home!
</router-link>

Looks like having child nodes in the default slot prevents HMR from working. I think that the rendering with h(...) (as seen here) doesn't work.

I'm using:

  • "vue": "^2.0.0-rc.4",
  • "vue-loader": "^9.4.2",
  • "vue-router": "^2.0.0-rc.4",

+1 :'-(

This is also tracked on the vue-router repo here: https://github.com/vuejs/vue-router/issues/662

Same bug but broader scope. Seems to affect all components? https://github.com/vuejs/vue-loader/issues/370

*related, not same.

*referring to @skyrpex 's comment

Does not seem like the same problem. I'm #370 you say nothing abiut duplicattion if replaced modules, you talk about changes not being applied at all.

+1

+1 Still in 2017

This comment will likely be ignored as it was:

  • done on a closed issue
  • Without providing a reproduction of the issue that you claim still exists.
Was this page helpful?
0 / 5 - 0 ratings

Related issues

matt-sanders picture matt-sanders  Â·  4Comments

TheVexatious picture TheVexatious  Â·  3Comments

lijialiang picture lijialiang  Â·  3Comments

amorphine picture amorphine  Â·  3Comments

jorgy343 picture jorgy343  Â·  3Comments