Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically close the browser tab opened by Parcel when HMR enabled #3027

Open
Kogia-sima opened this issue May 14, 2019 · 4 comments
Open

Comments

@Kogia-sima
Copy link
Contributor

🙋 feature request

Parcel CLI has an option '--open' which enables to opens bundled file with a browser automatically. However, if you stopped the HMR server with Ctrl + C, that tab does not close automatically, and then you have to close the tab manually.

🤔 Expected Behavior

When the websocket to the HMR server has disconnected, current browser tab closes automatically.

😯 Current Behavior

Browser tab remains and you have to close it manually.

💁 Possible Solution

See the implementation of suan/instant-markdown-d

🔦 Context

💻 Examples

$ cd /your/project/root/
$ ./node_modules/.bin/parcel --open firefox --target browser index.html

And press Ctrl + C. You can see the browser tab opened by parcel command does not close automatically.

@Taym95
Copy link
Contributor

Taym95 commented May 15, 2019

I would like to work on this but, how it is possible to execute window.close(); from the server side?

@mischnic
Copy link
Member

I'm not really convinced this is a helpful feature (would be rather unexpected).

Regarding implementation: The HMR server would need to emit a new event type ("close?") and the hmr runtime would then execute window.close:

@Taym95
Copy link
Contributor

Taym95 commented May 15, 2019

AH, I got it Thanks! I will try to submit PR :)

@gregid
Copy link

gregid commented May 15, 2019

This could only be a helpful feature if provided as an option and not a default, e.g. --autoclose

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants