electron / electron/forge

Webpack plugin fails to relaunch after `app.relaunch` in dev mode

Open
#3,787 0 comments 0 reactions 0 assignees View on GitHub
bug plugin/webpack web-multi-logger
Dominant language
TypeScript
Stars
7.1k
Forks
641
Avg merge
3d 1h
Merged PRs (30d)
30

Description

### Pre-flight checklist

- [x] I have read the [contribution documentation](https://github.com/electron/forge/blob/main/CONTRIBUTING.md) for this project.
- [x] I agree to follow the [code of conduct](https://github.com/electron/electron/blob/main/CODE_OF_CONDUCT.md) 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

7.6.0

### Electron version

v33.2.1

### Operating system

Windows 10(22H2)

### Last known working Electron Forge version

_No response_

### Expected behavior

I want to restart my app when settings changed. After searching the electron docs [here](https://www.electronjs.org/docs/latest/api/app#apprelaunchoptions), I added the following codes:

```js
ipcMain.handle('restart', () => {
app.relaunch()
app.quit()
})
```
The expected behavior is I can restart the app correctly.

### Actual behavior

When I invoked `restart`, the app did restart but showed following errors in the browser console
```
VM5:86 WebSocket connection to 'ws://0.0.0.0:3000/ws' failed: Error in connection establishment: net::ERR_SOCKET_NOT_CONNECTED
```

I did not use WebSocket in my project and the **ONLY** place I can find ws dependency is in electron-forge

```
"node_modules/@electron-forge/web-multi-logger": {
"version": "7.6.0",
"resolved": "https://registry.npmjs.org/@electron-forge/web-multi-logger/-/web-multi-logger-7.6.0.tgz",
"integrity": "sha512-Ln4Rn1H/hxs9USvwWmvUYnOIR8kobtglYWJXCERrua8A0zCWsVrs3edO/oKrg68eBd30tiDiJYGLme1ZEXxt+A==",
"dev": true,
"dependencies": {
"express": "^4.17.1",
"express-ws": "^5.0.2",
"xterm": "^4.9.0",
"xterm-addon-fit": "^0.5.0",
"xterm-addon-search": "^0.8.0"
},
"engines": {
"node": ">= 16.4.0"
}
}
```

### Steps to reproduce

Just call `app.relaunch` and `app.quit` after the app `isReady`

### Additional information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.