ktsn / vue-template-loader

Vue.js 2.0 template loader for webpack
MIT License
266 stars 26 forks source link

Support HMR of js files #21

Closed Toilal closed 7 years ago

Toilal commented 7 years ago

Do you think it's possible to add support for HMR on component js/ts files ?

Currently it's the only real drawback remaining from this loader compared to vue-loader with .vue files.

Toilal commented 7 years ago

I'm quite new to webpack, but if I understand well, it should be possible by creating another loader (maybe a script-loader.js) for script files to add the hot reload code the same way it's done in template-loader.js with writeHotReloadCode().

This new loader could be configured with a rule on *.js files.

ktsn commented 7 years ago

Thanks for thinking to improve this loader. But unfortunately, it's out of the scope of this loader. The main purpose of vue-template-loader is to compile a template and inject it to a component code and it optionally deals with a style for convenience.

We can implement a new loader to hot reload for scripts, but I think it should be provided as other package such as vue-hot-reload-loader. So that the users can choose any hot reload loader they like.