parcel-bundler / parcel

The zero configuration build tool for the web. 📦🚀
https://parceljs.org
MIT License
43.51k stars 2.27k forks source link

🙋--open for electron #1878

Open ycmjason opened 6 years ago

ycmjason commented 6 years ago

🙋 feature request

parcel index.html --open

Opens the default browser. However when we are targeting electron:

parcel index.html --target electron --open

I think it makes total sense that this command would call:

electron .

So that I won't have to open up another terminal to run that separately.

🤔 Expected Behavior

parcel index.html --target electron --open

Should call electron . to open the electron window.

😯 Current Behavior

Not sure what the flag does now when --open is specified.

💁 Possible Solution

I haven't look into a solution yet. But I am happy to work on this if you think this is a good idea.

Hammster commented 6 years ago

I like the idea, but there are several things to consider regarding the electron main process output. Currently parcel just overwrites the line buffer.

Another thing to consider is HMR, you will probably need to use the API in order to get your electron stuff working which makes the use of parcel CLI interface useless unless we could parse in a config file which in the reverse conclusion is not necessarily zero-configuration anymore.

ycmjason commented 6 years ago

I agree with your first point about the output.

But for HMR, don't we already support it?

Hammster commented 6 years ago

We support it, but in most cases people will use parcel only for the render process, but sometime people use it in the main as well. And when the main process code is transpiled/patched you actually don't want to HMR it since it can cause some issues (spawning windows on reload etc.).