Vue-cli-plugin-electron-builder: HMR doesn't work

Created on 24 Jun 2018  路  14Comments  路  Source: nklayman/vue-cli-plugin-electron-builder

Hi!

HotModuleReplacement doesn't work in version alpha.9. I need to reload window in order to view changes.

Regards!

Most helpful comment

@u3u With 1.0.0-beta.6, electron is restarted automatically when the main process changes!

All 14 comments

This is really annoying to fix as it works when I link the package, but not when added remotely. I will still look into this though.

I use jsx instead of templates, and I solved this problem by manually configuring vue-jsx-hot-loader. However, you need to manually run yarn serve:electron every time the main process code is modified.

I want to ask extra questions here:

  1. Is it possible to output an error message on the terminal when the main process has an error?
  2. How to debug the main process?

If there is an error in the main process, it should be logged in the console and the program should exit. If that is somehow missing, please create a separate issue with reproduction steps. The main process does not have hot reload as electron would have to be relaunched every time it changes (let me know if I'm wrong). As for debugging the main process, I'm currently working on an implementation for that and would appreciate a PR 馃槃 .

What do you think about having serve:electron take a --debug argument that disables minification of the main process and doesn't launch electron? Then, electron can be launched through a debugger as documented here.

@nklayman:
The main process does not have hot reload as electron would have to be relaunched every time it changes (let me know if I'm wrong).

Can you let it restart automatically when the main process changes? 馃

@nklayman:
Take a --debug argument that disables minification of the main process and doesn't launch electron

I think this is good 馃槃

I was also thinking that I could export a function used for testing. It starts serve: electron and returns a promise that resolves when the server is ready, including info like the server url. This would be helpful for testing with spectron. Do you think this would be useful? I could also configure electron to restart on the main process change.

Beta.4 has been released with testing and debugging support. Unfortunately, no HMR or auto restarting electron when main config changes (yet).

@u3u With 1.0.0-beta.6, electron is restarted automatically when the main process changes!

@nklayman thank you very much!

HMR works fine on Linux, not sure about Windows (will check soon) or MacOS.

I tested on Windows and works fine.

HMR for the renderer process is not working now on windows. Electron 2^
The console logs its running and waiting for an update, the system rebuilds to renderer process just doesnt replace the modules or "reload"

@Kaffiend can you confirm that it doesn't work with a blank project, and that it works with a regular serve. It works fine for me on linux with a blank project.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Timibadass picture Timibadass  路  6Comments

JamesDream87 picture JamesDream87  路  5Comments

mrin9 picture mrin9  路  6Comments

iamazik picture iamazik  路  5Comments

AlexSHoffman picture AlexSHoffman  路  3Comments