3 ms·
This already exists: the browser is the shared runtime. What needs to happen is everyone shipping Electron should instead ship a local HTTP server and open the
by modeless 6y ago
This already exists: the browser is the shared runtime. What needs to happen is everyone shipping Electron should instead ship a local HTTP server and open the user's default browser to run the UI. You can hide the browser chrome and make real top level windows by making your app a PWA. Anything else that needs to happen outside of the browser sandbox can be handled by the local server.
The only disadvantage is you lose control over the browser version that's running, but you also lose that with a shared runtime (unless every app pins their own runtime version which defeats the purpose of sharing). Besides, most Electron apps also have a web version that has to support all browsers anyway. The advantage is you seriously reduce the disk and memory footprint of your app and shed the responsibility of shipping prompt patches for Chromium security issues.
- mceachen 6y ago> should instead just ship a local HTTP server and a Node.JS runtime, and native libraries to support menubars, system trays, dialogs that support folder selections, native drag and drop for all file types, ... I agree, though: if the electron app doesn't need any of these things, it really shouldn't pull in the entire electron runtime.
- modeless 6y agoNode is a lot smaller than Chromium. Even if the app does want some of the other things you list, it's possible to do all of them from the server, and it'll remain a fraction of the size of Electron.
- 0df8dkdf 6y agoyeah just use Chromium as the GUI interface and do everything else in node. Come on! Someone goto have alredy done this, no?
- mkl 6y agoWith a local server, how do you avoid Windows's scary confusing firewall prompts? I'm sure they cost users, and for a local app they don't make sense. Is there a way to make your server local-only that will prevent them?
- modeless 6y agoYou can bind to the loopback interface so the server isn't exposed to the network. I am not sure if Windows will choose to show the scary dialog in this case. To be absolutely sure, according to Stack Overflow you can request admin privileges (standard for Windows installers of course) and add a firewall rule yourself allowing any network communication you want.
- fomine3 6y agoWe are losing Chrome Apps.