Anyone have a favourite alternative to Electron if...
# present-company
i
Anyone have a favourite alternative to Electron if I just want to write vanilla JS (not TypeScript, not React), and preferably style with actual CSS stylesheets (not inline styles, not CSS-in-JS)? Primary deploy target is Mac OS, though Windows support would be very useful.
j
I just started messing around with NW.js. It seems refreshingly lightweight & direct, compared to my past experience with Electron. Can't say much more yet, but it's worth checking out!
🤔 2
t
I was at a company that built a macos/windows app which used nw.js (circa 2015), but we decided to move to electron because it wasn’t getting many updates (think it was only 1 person maintaining it at the time), and electron seemed like a more stable platform. Electron was a beast, but it did its job for the most part. Have been keeping tabs on the space since, and these are 2 others that have come up relatively recently (I haven’t used either) https://tauri.studio/ https://neutralino.js.org/
👀 1
j
You can get a very lightweight cross-platform web viewer in C with one header file: https://github.com/webview/webview
😑 1
👍 2
n
Have 127.0.0.1 web servers become a faux pas since the Zoom incident ?
j
@Ivan Reese Why the 😑? It shouldn't be difficult to write a <100 line C wrapper that injects your chosen JS into the context. 🤷🏻‍♂️
i
Oh, I was just surprised by the suggestion, as it's a few steps away (and around the corner) from what I had in mind. Electron is a rather batteries-included way to do quick-and-dirty cross-platform development. I have an old Adobe AIR app that needs a rewrite, and if you squint a bit, Electron seems like a suitable AIR successor. Whereas writing an app in C requires one to take more responsibility for how your binary interacts with the OS — responsibility I'd rather shirk.
👍 1
w
Oh AIR!
c
@Ivan Reese what don't you like about electron? It could help with figuring out what a good alternative is, because my understanding is that Electron is as bare bones as you want it to be. It's hard to ignore the fact that Electron seems to have almost 100x the adoption of anything similar, which has resulted in it getting more optimizations and stability on many platforms. Along with there being many more resources for code signing to macOS (which is a hard problem other smaller electron alternatives have not gotten to like https://github.com/tauri-apps/tauri)
Also, how much time are you willing to invest to avoid electron? I think Horowitz's suggestion of NW.js seems to be the most mature & similar to Electron (at least I've heard about it a long time ago), but others may have a steeper learning curve to get set up since the tooling may be more hit and miss or have issues with Apple M1 while Electron gets sorted out more quickly (perhaps)
j
@Cole One reason to avoid Electron is resource use. Each Electron app uses a specific non-shared, multi-hundred megabyte version of Chrome under the covers. The webview library I posted upthread uses whichever browser engine shared library is already bundled with the operating system, making the executable tiny and the memory footprint while running much smaller.
3
i
Good questions. This is only my 2nd Electron project (the first being the rough prototypes for my FoC project, Hest), so I'm just now getting out of the early part of the learning curve. I'm at the point where I understand what it's like to work with Electron, and so I'm interested in looking at the other options — ideally, other options that people like better than Electron — to see what those projects have decided to do differently, and to for the first time feel that difference. I've looked at other options in the past (pretty much everything linked in this thread, as it turns out, so I guess the field is pretty small), but I wasn't able to really get much of a sense for each project beyond this looks unsupported, or the gaps in the docs are worrying. But now that I know some of the not-obvious pains and joys of Electron, I was hoping that reflecting on alternatives would help me discover a few more not-obvious pains and joys. No luck, but it was worth a shot!
👍 1
c
I wrote a Python library that simplifies the 127.0.0.1 server technique. I'm not proud of it but it exists 😂 github.com/ChrisKnott/Eel I believe one day OSes will ship with an offline HTML/js GUI system built-in, which will make the Electron approach less ridiculous, and Electron itself redundant
What was "the Zoom incident"? @Nick Main
n
Zoom used a local HTTP server in their Mac App and it was a scandal a couple of years ago https://www.zdnet.com/article/zoom-defends-use-of-local-web-server-on-macs-after-security-report/