Reputation: 841
I'm using electron and I have an ejected create react app webpack config. I have Hot Module Replacement enabled.
The hot updates are generated, in the terminal I see e.g. 5f4dde8b4941bfe36ef8.hot-update.json, but the client can't seem to find these updates
Any idea how I can debug or fix this issue?
I have my suspicion is the path the client is trying to look for the updates on is wrong.
In the client console, I can see:
[HMR] Waiting for update signal from WDS...
[WDS] Hot Module Replacement enabled.
[WDS] App updated. Recompiling...
[WDS] App hot update...
[HMR] Checking for updates on the server...
[HMR] Cannot find update. Need to do a full reload!
[HMR] (Probably because of restarting the webpack-dev-server)
excerpt of webpack config:
entry: [
'webpack-dev-server/client?http://0.0.0.0:8080',
require.resolve('webpack/hot/only-dev-server'),
require.resolve('react-hot-loader/patch'),
require.resolve('./polyfills'),
require.resolve('react-error-overlay'),
paths.appIndexJs,
],
output: {
path: paths.appBuild,
pathinfo: true,
filename: 'static/js/bundle.js',
chunkFilename: 'static/js/[name].chunk.js',
publicPath: '/',
devtoolModuleFilenameTemplate: info =>
path.resolve(info.absoluteResourcePath).replace(/\\/g, '/'),
},
excerpt of webpack dev server config:
contentBase: paths.appPublic,
hot: true,
publicPath: config.output.publicPath,
Upvotes: 1
Views: 2917
Reputation: 841
So I found the issue, for anyone else coming to this for trouble getting HMR to work with electron and create react app. If you have ejected your webpack config, you need to change the target in your webpack.config.dev from electron
to electron-renderer
target: "electron-renderer"
also require.resolve('react-hot-loader/patch')
was not needed.
Upvotes: 1