TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: Why / Why Not Use Electron?

12 pointsby mc42almost 9 years ago
More and more apps that I've seen published here are heavily disliked for their usage of Electron. What experiences have you had with Electron and why / why isn't it a good idea to write an application with it?

10 comments

eivarvalmost 9 years ago
<i>Why not:</i><p>In my experience, Electron apps tend to be bloated, not very performant and&#x2F;or energy inefficient. This means that developers make a choice regarding users&#x27; disk space, user experience and battery life. The extent to which users notice any of this is of course dependent on a combination of their machine (e.g. old&#x2F;new hardware, laptop&#x2F;desktop) and the application being run.<p>Also, since you don&#x27;t use the platform&#x27;s native widgets, there&#x27;s poor (or nonexistent?) accessibility features for users with special needs - not to mention the implications (HCI-wise) of redefining&#x2F;replacing standard interface elements.<p>In my opinion, all this reeks of poor design, and is arguably (in some cases) downright user-hostile and unethical.<p>To portray it as &quot;native&quot; is, frankly, ridiculous.<p><i>Why:</i><p>The main thing Electron does well is lower the barrier to entry and maybe increase development speed.<p>I can definitely see use cases, such as quick prototypes and internal applications. And it is cross-platform. There&#x27;s probably other good reasons to use it as well.
bengineeralmost 9 years ago
I personally love it. I&#x27;ve only written a couple of small, really simple apps, but I&#x27;ve got a couple more under way. To me, the idea of writing desktop, native apps, utilizing the web development technologies I already know, is bad ASS. the sizes are on the high side for some things, sure, but that&#x27;s not really a HUGE deal breaker for me.
评论 #12120000 未加载
smt88almost 9 years ago
I dislike Electron apps that I use because they&#x27;re incredibly bloated. I don&#x27;t know if that&#x27;s always a guarantee with Electron.<p>I&#x27;ve seen people criticize Electron for being slow&#x2F;unresponsive, but VS Code is incredibly fast and responsive, so I know for a fact that Electron usage doesn&#x27;t guarantee slowness.
评论 #12120271 未加载
Hamchaalmost 9 years ago
Bigger drawback is that it&#x27;s bloaty, I have a mix of Chrome apps and Electron apps, the Electron are big (40+ MB) and take much longer to start because they have their own Chrome to open, while the Chrome apps just use the global Chrome instance that&#x27;s already open.<p>I wonder if we&#x27;ll someday get something akin to the JVM for Chromium-based stuff. We&#x27;d finally have a single install that could be updated and every app being kilobytes instead of megabytes.
评论 #12120459 未加载
david90almost 9 years ago
Pro Simple to build, cross-platform - even linux supported.<p>Con The default electron build is quite large, typically &gt;50mb for a single page app.
babyrainbowalmost 9 years ago
Something I have always wondered.<p>The first version of firefox was 5 mb and chrome was 9 mb or so. Can&#x27;t we bundle such a light version of the browser, instead of always bundling the latest and greatest? Shouldn&#x27;t it be enough to render the gui&#x27;s of native apps?
aehardingalmost 9 years ago
<a href="https:&#x2F;&#x2F;youmightnotneedelectron.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;youmightnotneedelectron.com&#x2F;</a>
supernintendoalmost 9 years ago
Pros:<p>- Productivity: The browser renderer and Node (as well as the open source ecosystems that accompany those environments) offer you a lot. HTML, CSS and JS are relatively easy and because there are a lot of web programmers out there, your access to developers, developer resources and libraries is vast.<p>- One portable target: Develop your app for multiple operating systems without worrying about many of the problems inherent in web programming (ES6 support, CSS inconsistencies between browsers, etc.) or cross platform development (compilation, dynamic linking, header &#x2F; include guards, etc.)<p>- Decent OS integration: Interacting with filesystem, native OS menu bars, notifications, etc. is fairly simple.<p>- Multiple language support: Electron uses JavaScript for application logic but you could alternatively use CoffeeScript, TypeScript, ClojureScript, Elm or any language that can compile to JS.<p>- Performance when you need it: Use something like node-ffi [1] or SWIG [2] if you need C or C++.<p>Cons:<p>- Memory usage: An Electron app is essentially a fully-featured Chromium browser and a Node process that communicate via IPC. This might be a bit bloated for some applications, particularly if you&#x27;re targeting systems where memory is limited.<p>- Large builds: Packaged Electron apps contain everything they need to run so they&#x27;re typically quite large. Don&#x27;t be surprised if your &quot;hello world&quot; app ends up being over 30MB.<p>- Not truly native: Sure, you can make your app look great but the only way you can make it look 100% &quot;native&quot; is to use the widget toolkits of whatever operating systems you&#x27;re targeting. Electron does not give you access to this.<p>- The DOM can be your worst enemy: This is where the performance issues of many Electron apps (Atom comes to mind) arise. Depending on the complexity of your app, you&#x27;ll want to either limit how many elements you render to the page at any given moment or look into using something like HTML5 canvas to render.<p>- Single threaded: Node is single threaded. If true concurrency is important to you, you might consider another platform.<p>Overall, I love Electron. It&#x27;s not the right choice for all applications but if you have experience developing for the web and want a desktop application platform that is easy to get into, I&#x27;d give it a shot.<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;node-ffi&#x2F;node-ffi" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;node-ffi&#x2F;node-ffi</a><p>[2] <a href="http:&#x2F;&#x2F;www.swig.org&#x2F;" rel="nofollow">http:&#x2F;&#x2F;www.swig.org&#x2F;</a>
nameless912almost 9 years ago
Being totally honest, I have <i>very</i> little experience when it comes to designing desktop apps. Most of my experience in UI development has been in either Swing (ew) or Qt&#x2F;C++ (slightly less ew, but still ew).<p>I kind of hate the idea of Electron, and this is for a variety of reasons:<p>* I think Javascript is a terrible language. * I think HTML&#x2F;CSS is a terrible language. * I think the web is too bloated as it is, and extending that paradigm to the desktop only encourages more lazy, bloated development.<p>That being said, I get the appeal Electron has for a lot of people. If you already know web development, then writing a desktop app becomes a no brainer. If you&#x27;re already a destkop UI guy, you can learn Electron and be a web front end guy too. All good things.<p>But the idea of using a fucking <i>gigantic</i> framework (I mean think about it, just Electron by itself is <i>all of Chromium</i> basically, or at least the big complicated exciting bits) is a massive code smell to me. It&#x27;s like using an ORM or a heavyweight web framework: whenever you&#x27;re leaning on that much code just for your baseline of functionality, you&#x27;re making a lot of assumptions that should, as a developer, at least give you pause. One of the things I love about Swing is that I can spin up a basic prototype in a couple hours with just a couple hundred lines of &lt;insert non-java JVM language here&gt;. And besides the built-in language UI framework, I own every piece of that code and can tell you what it all does. I feel like web development (an by extension, Electron) doesn&#x27;t have any of those desirable attributes.<p>Web development often involves hundreds of lines of boilerplate, the import of a several-thousand line Javascript API, a heavy CSS framework like bootstrap (for prototyping, at least), and the assumption that the magic will all just work. I know that fundamentally there isn&#x27;t that much difference between writing an app in Swing versus Electron if we&#x27;re talking about complexity, nor is there that much difference in performance for simple cases. But it just <i>feels</i> better for me if all I&#x27;m doing is a few API calls (even if the underlying code is similarly complex).<p>Now, there is one exception to all of this: one of the apps someone on my team supports at work is our monitoring dashboard&#x2F;customer service portal. Because of some bizzar-o rule from up top, we aren&#x27;t allowed installing anything except for absolutely essential apps on the support machines. Electron proved to be a lifesaver here because we could wrap our web-based portals in &quot;desktop-y&quot; apps and get rid of the web browser entirely. For cases like that (or like a friend of mine, who is currently working on medical instrument displays and uses JS&#x2F;Electron in a couple of experimental projects because it&#x27;s easier than Qt and the machines run Linux or Windows 7 anyway) where really what you need is a website, wrapped in a clean sandboxed container, I can kind of understand its niche.
评论 #12126964 未加载
maxharrisalmost 9 years ago
Why not use React native? Putting a browser inside your mobile or desktop app is always going to be bloated and slow compared to using JavaScript to drive native views.<p>(Users might not notice that bloat and slowness if they&#x27;re on a desktop system with a fast CPU and lots of RAM, which is one reason why Electron seems okay in certain cases.)
评论 #12119618 未加载
评论 #12120184 未加载