3 ms·
Nice breakdown of wasted resources.. It's frustrated me for a long time how people are carelessly bundling unused code, which is unfortunately common in JavaScr
by lioeters 8y ago
Nice breakdown of wasted resources.. It's frustrated me for a long time how people are carelessly bundling unused code, which is unfortunately common in JavaScript-land.
Including only the bundled/minified app is possible, leaving no node_modules folder at all - or, at least, just the native binaries needed.
As for bundling the whole Electron runtime on every app: technically it's possible to have a shared runtime - as this 3-year old issue shows, many people have attempted various approaches: https://github.com/electron/electron/issues/673 https://github.com/electron/electron/issues/673
However, sadly no one has stepped up to come up with a general solution. While there are disadvantages and some reasonable arguments for bundling the exact version of the runtime required by an app, it seems efficent use of resources isn't enough of a priority..
- ehnto 8y agoI'm not sure what it is about the node development environment but you are right. I haven't seen such wildly complicated dependency trees in any other language. Literally hundreds of modules can come together to make even simple applications. Is there an idiom or ethos in node land that aims for tiny re-usable packages? I am not criticising if there is, just genuinely curious. I have been writing JS applications for years and it's only since node and npm hit the scene that this has occured.
- Lowkeyloki 8y agoIt might be the Unix philosophy taken to its logical extreme. Everything should do one thing and do it well. So now we have libraries that are literally a single function.
- shittyadmin 8y agoHere's the thing though: You could build this in pure Node and call Windows APIs, Qt, etc and it'd be much, much smaller. But everyone just goes ahead and pulls in Chrome. It's shameful, and the worst part is that I get it - at this point I'm suggesting we go to Electron for a new application at work because it seems like the best maintained UI frameworks with readily available 3rd party components are all web based.
- Lowkeyloki 8y agoI find it darkly funny that Electron is the new size/waste-of-resources whipping boy. Java applications generally suffer the same issues with the exception that the runtime isn't usually distributed with every application. But the goal of write once, run anywhere is basically the same. Now that Java is being developed at such a speedy clip at the cost of breaking changes, we may see Java runtimes being shipped with apps. (I'm personally still on Java 8 because that was the last release before drastic breaking changes started happening.) Just kidding. Java has been abandoned in favor of web apps anyway.