Add fast refresh (hot reload)
Opened this issue · 4 comments
I didn't manage to include fast refresh keeping state through updates inside React yet.
@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`),
});
}
Hey @Abdallah-Moh, we already have live reload. I want do add React Fast Refresh that keep react state between file changes.
@diego3g you will need to disable the live reload and update the DOM instead
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.