Skip to content

Vue router and hot reload #129

Closed
Closed
@GianlucaGuarini

Description

@GianlucaGuarini

Hi thanks for this awesome cli tool, I landed here thanks to an official vuejs tweet. I have followed the suggestion but despite the 50 npm dependencies required by the webpack template I wasn't able to get HMR in my app where I use the vue router to render my components. I have created a simple repo where anytime I update a component the page gets reloaded
https://github.com/GianlucaGuarini/vue-hmr-test/blob/master/src/main.js

Am I doing something wrong? Any hint about how achieving HMR also with vue-router and vuex?

Activity

yyx990803

yyx990803 commented on Jul 25, 2016

@yyx990803
Member

Vue hot-reload works through vue-loader, so only components imported from *.vue files can be hot-relaoded.

On a higher level, Webpack HMR works based on modules, so there's no way to magically hot-reload an inline component defined in a random file.

GianlucaGuarini

GianlucaGuarini commented on Jul 26, 2016

@GianlucaGuarini
Author

Ok thanks Evan now it's clear. Probably a couple of lines about this in the doc would help other users as well

GianlucaGuarini

GianlucaGuarini commented on Jul 26, 2016

@GianlucaGuarini
Author

@yyx990803 I have tried to follow your recommendations but it seems that the hot reloading is not handled properly check the video:

I have updated the test repo as well. Do you know any workaround?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @yyx990803@GianlucaGuarini

        Issue actions

          Vue router and hot reload · Issue #129 · vuejs/vue-cli