Comments (8)
This issue is inherent to how Electron works (at least on Windows). When an electron app is launched, it will create a new process group, separate from the command line process. When you app.relaunch()
, it will in fact launch a second instance of the app when the first one exits. Anything running in-process inside the electron app won't have any control over the reuse of stdio, which is why this and all the other in-process live reloaders have this issue. Without digging into the electron source code itself to figure out if electron can be changed to allow for better restarts, the best way I have found to deal with this issue is using an out-of-process manager like electronmon
.
from electron-reloader.
On MacOS, I'm hitting pretty much the same issue; on reload the terminal process exits and the app closes, then the app reopens (but the terminal process does not reconnect, leaving me with no console logs).
from electron-reloader.
Ohh so this is just a replacement for Refresh❓
When files used in the main process are changed, the app is restarted, and when files used in the browser window are changed, the page is reloaded.
I still don't understand this bcz my terminal stops but the app is still running & AFAIK when terminal stops app also closes when this package is not used.
from electron-reloader.
From the top of the readme:
When files used in the main process are changed, the app is restarted, and when files used in the browser window are changed, the page is reloaded.
from electron-reloader.
Hey @sindresorhus, first off; thanks for the package! Adding my comment/question here since it's somewhat related to the issue opened.
I just initialized a new app using electron-forge & added electron-reloader.
I've included require('electron-reloader')(module);
in a try-catch
& if I make a change on main.js
, the app restarts - but I end up with two windows. Make another change & now I have 3 windows.
It wasn't completely clear from the README
whether this is expected (I would expect not), but wanted to check with you.
Thanks!
from electron-reloader.
I was also a bit confused as even though editing main.js does restart the app, it also exits the original process so you're left without terminal. I tried to patch around the source code but didn't get far, so decided to add my main process files to electron-reloader ignore
option, and am using the following script to start the app. Perhaps others coming across this will find it helpful (you'll probably want to adjust the args to spawn
to reflect your needs):
https://gist.github.com/Lokua/b88ffc4aa32398abe3cf8688444799ac
from electron-reloader.
@IssueHunt has funded $40.00 to this issue.
- Submit pull request via IssueHunt to receive this reward.
- Want to contribute? Chip in to this issue via IssueHunt.
- Checkout the IssueHunt Issue Explorer to see more funded issues.
- Need help from developers? Add your repository on IssueHunt to raise funds.
from electron-reloader.
https://www.youtube.com/watch?v=b-ATD74MQkw
from electron-reloader.
Related Issues (19)
- Support Hot Module Replacement (HMR)
- Electron 7.1.7 - not working HOT 1
- When the app is reloaded the original terminal is closed HOT 7
- Delete this
- Transpiling main process HOT 10
- Add a note to README indicating that using electron-reloader in a static script avoids problems with transpiling main electron process HOT 1
- Crash Reporter continually showing up HOT 1
- Possible bug with ignore regex parsing? HOT 1
- Electron app.relaunch() fails with v15.3.0 on Windows 10 x64 HOT 3
- "Maximum call stack exceeded" with circular module references
- What is the difference between this and HMR? HOT 1
- How to solve the problem that fsevents.node in chokidar is compiled during the compilation phase of webpack production and packaging, isn't electron-reloader dynamically imported by require? HOT 1
- can not work
- no console output HOT 1
- When running in development, two windows appear HOT 3
- Add ESM support HOT 3
- Add option to force relaunch always
- Doesn't work when main entry file is in a sub-folder HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from electron-reloader.