Skip to content

hot reload? #28

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

Closed
michaelkrupp opened this issue Nov 10, 2016 · 4 comments
Closed

hot reload? #28

michaelkrupp opened this issue Nov 10, 2016 · 4 comments

Comments

@michaelkrupp
Copy link

michaelkrupp commented Nov 10, 2016

Are there any plans to support hot-reloading of templates like for example vueify does?

@ktsn
Copy link
Member

ktsn commented Nov 12, 2016

In my understand, unfortunately, vue-class-component cannot include hot reloading feature because it cannot have code generator as it is runtime library.

To provide hot reloading, we need to trigger vue-hot-reload-api on hot reload and its code have to be placed on updated file. vue-loader and (not sure but probably) vueify inject the code while transform .vue files.

FYI: The hot reload feature of vue-loader and vueify should also work with using vue-class-component.

@tonypee
Copy link

tonypee commented Feb 23, 2017

I just realized that using vue-class-component is the cause of my hmr not working.. quite disappointing. Are there plans to get around this?

@ktsn
Copy link
Member

ktsn commented Feb 23, 2017

vuejs/vue#4976 ?

@s-KaiNet
Copy link

FYI: The hot reload feature of vue-loader and vueify should also work with using vue-class-component.

I found that to make it work with TypeScript you should provide additional configuration, because ts-loader doesn't support hmr with default settings.

  1. Set transpileOnly: true for ts-loader. In that case we lose type checking.
  2. TypeScript without type checking is useless. For type checking install fork-ts-checker-webpack-plugin with below config:
new ForkTsCheckerWebpackPlugin({
      tslint: true,
      vue: true
    }),

I've created starter project to demonstrate this approach - vue-ts-sfc-webpack-hmr
Starter doesn't use vue-class-component, however everything should be valid for vue-class-component with TypeScript as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants