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

Add fast refresh (hot reload) #52

Open
diego3g opened this issue Jun 20, 2021 · 4 comments
Open

Add fast refresh (hot reload) #52

diego3g opened this issue Jun 20, 2021 · 4 comments
Labels
enhancement New feature or request

Comments

@diego3g
Copy link
Owner

diego3g commented Jun 20, 2021

I didn't manage to include fast refresh keeping state through updates inside React yet.

@diego3g diego3g added the enhancement New feature or request label Jun 20, 2021
@ghost
Copy link

ghost commented Jun 24, 2021

@diego3g Did you try electron-reload this will hot reload window on folder content changed
eg:

if (isDev) {
  require("electron-reload")(path.join(__dirname, "public"), {
    electron: require(`${__dirname}/node_modules/electron`),
  });
}

@diego3g
Copy link
Owner Author

diego3g commented Jul 2, 2021

Hey @Abdallah-Moh, we already have live reload. I want do add React Fast Refresh that keep react state between file changes.

@ghost
Copy link

ghost commented Jul 2, 2021

@diego3g you will need to disable the live reload and update the DOM instead

@CGamesPlay
Copy link

Just got this working. Requires "@electron-forge/plugin-webpack": "6.0.0-beta.60", because of electron/forge#2444. Then you can add something similar to this to package.json:

          "@electron-forge/plugin-webpack",
          {
            "devServer": {
              "liveReload": false,
              "hot": true
            },

And from there follow the normal installation instructions according to react-refresh-webpack-plugin.

Note that you have to manually list HotModuleReplacementPlugin in your plugins, or else it won't be detected.

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

No branches or pull requests

2 participants