Giter VIP home page Giter VIP logo

Comments (8)

catdad avatar catdad commented on May 28, 2024 7

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.

j0hnm4r5 avatar j0hnm4r5 commented on May 28, 2024 4

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.

deadcoder0904 avatar deadcoder0904 commented on May 28, 2024 3

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.

sindresorhus avatar sindresorhus commented on May 28, 2024 1

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.

1nv1n avatar 1nv1n commented on May 28, 2024 1

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.

Lokua avatar Lokua commented on May 28, 2024 1

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.

IssueHuntBot avatar IssueHuntBot commented on May 28, 2024

@IssueHunt has funded $40.00 to this issue.


from electron-reloader.

MegaJSDeveloper avatar MegaJSDeveloper commented on May 28, 2024

https://www.youtube.com/watch?v=b-ATD74MQkw

from electron-reloader.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.