electron / forge

:electron: A complete tool for building and publishing Electron applications
https://electronforge.io
MIT License
6.41k stars 505 forks source link

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

Open zxch3n opened 2 years ago

zxch3n commented 2 years ago

Pre-flight checklist

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

Keller18306 commented 4 weeks ago

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)