Skip to content
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

v4.0.0 Beta not working with electron #794

Closed
rllola opened this issue Jan 15, 2018 · 12 comments
Closed

v4.0.0 Beta not working with electron #794

rllola opened this issue Jan 15, 2018 · 12 comments
Assignees
Labels

Comments

@rllola
Copy link

rllola commented Jan 15, 2018

If you are reporting a bug or having an issue setting up React Hot Loader, please fill in below. For feature requests, feel free to remove this template entirely.

Description

The HMR doesn't work with electron.

Expected behavior

When changing some html code I expect the electron application to show those modification.

Actual behavior

Nothing is happening

Environment

React Hot Loader version: 4.0.0-beta.14

Run these commands in the project folder and fill in their results:

  1. node -v: v7.10.1
  2. npm -v: 5.4.2

Then, specify:

  1. Operating system: ubuntu 16.04
  2. Browser and version: electron-prebuilt-compile 1.8.2-beta.3

Reproducible Demo

https://github.com/rllola/hmr-example-issue/tree/hello

@theKashey
Copy link
Collaborator

Could you please try to setup RHL v4 as v3. Ie with "manual" module.hot.accept/AppContainer in index.js, and without hot.
Maybe self-acceptance is working differently in Electron.

@theKashey
Copy link
Collaborator

Related #720. So it is not working?

@theKashey
Copy link
Collaborator

Confirmed. Degradation due to the changes made for #775 - "could not override .render method, as long it read only."

@theKashey theKashey added the bug label Jan 15, 2018
@theKashey theKashey self-assigned this Jan 15, 2018
@theKashey
Copy link
Collaborator

Regardless of regression in beta-14 this example runs perfectly for beta-12/13.
But there is just no HMR event from Electron.
It should print out Got HMR signal!, but it don't.

@rllola
Copy link
Author

rllola commented Jan 16, 2018

I have done a little bit more research on it.

I am using electron-forge and I tried to generate a new project using react template. It use by default the v3.0.0 version. It works great.

I updated to version v4.0.0-beta.13 and did the modification to use hot(module)(App) and now it is not working.

When I am activating the debug for electron-compile:require-hook I have the Got HMR signal! message but no modification.

Could it be linked to babel's react-hot-loader/babel plugin ?

@rllola
Copy link
Author

rllola commented Jan 16, 2018

Here the example repo : https://github.com/rllola/hmr-example-issue-2

I hope it will help.

@theKashey
Copy link
Collaborator

theKashey commented Jan 16, 2018

For me HRM fires only once. If I will change any file once again - no HRM will be sent.
Also it always does nothing, as you said, but thinks that everything is ok. Internally it does update all required components.
Could you provide a workable (v3) version?

@rllola
Copy link
Author

rllola commented Jan 17, 2018

@theKashey Are you using webstorm ? I do receive the signal everytime I make a modification.

@theKashey
Copy link
Collaborator

It's not related to IDE. But yes - I am using Webstorm. But no - I am running yarn outside of IDE.
So - could you just provide an example for v3, I just need solution without hot.

@rllola
Copy link
Author

rllola commented Jan 18, 2018

I was wondering if it wasn't linked to this : #343
One of my colleagues had this problem with webstorm

Here the working branch with v3 (unfortunately it was broking instanceof and we were waiting for v4 which fix it) : https://github.com/rllola/hmr-example-issue-2/tree/v3

@theKashey
Copy link
Collaborator

Ok. @rllola - I've solve your problem.
RHL v4 do provide hot function, to auto-configure HRM, setting self-acceptance rule for a module.
In case of Electron - module.hot sets acceptance for application, and you also have to re-require yourself manually - electron just clears the cache.

Solution - take your v3 branch and just install RHL v4. Dont change the code. Just bump version.

I hope it will help. (please confirm)
I'll try to find a proper solution, meanwhile going to create a section in README for Electron.

@rllola
Copy link
Author

rllola commented Jan 18, 2018

I confirm it is working.
I am closing this issue then. Thank you.

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

No branches or pull requests

2 participants