forge icon indicating copy to clipboard operation
forge copied to clipboard

HMR not working: electron forge does not allow user to overide devServer.static config

Open zxch3n opened this issue 4 years ago • 1 comments

Pre-flight checklist

  • [X] I have read the contribution documentation for this project.
  • [X] I agree to follow the code of conduct that this project uses.
  • [X] I have searched the issue tracker for a bug that matches the one I want to file, without success.

Electron Forge version

6.0.0-beta.61

Electron version

15.1.1

Operating system

macOS 11.6

Last known working Electron Forge version

No response

Expected behavior

allow user to overide devServer.static config

https://github.dev/electron-userland/electron-forge/blob/c05748519b8257f100e9e3dbf9903258baa85056/packages/plugin/webpack/src/WebpackPlugin.ts#L353-L374

Otherwise react HMR is not working. It will always reload the page if change detected.

Actual behavior

React HMR is not compatible with electron forge. Because static file changed right after content is modified, and the watch config will cause the page refreshing.

Steps to reproduce

as above

Additional information

No response

zxch3n avatar Oct 27 '21 09:10 zxch3n

Still very relevant. In addition to this, this line breaks hot reload:

https://github.com/electron/forge/blob/6c32c69685c7b211f78f0acb99d62676c70f8557/packages/plugin/webpack/src/WebpackPlugin.ts#L555

(Because after compilation, the files get there, and since webpack considers this static, then when changing the static, it performs a full page reload, instead of hot reload)

Keller18306 avatar Aug 13 '24 23:08 Keller18306