Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make electron app smaller?

Tags:

I just recently built an electron app and packaged it using electron-packager. The .exe file is 55,000kb and the rest of the folder is quite bulky as well. Is there any way to take down the size of this application at all?

like image 290
John Wick Avatar asked Nov 15 '17 15:11

John Wick


People also ask

Why is my Electron app so large?

Electron applications consume a lot of disk space because each application is bundled with Chromium and Node. On the other hand, Tauri and Neutralino. js have surprisingly lightweight bundle sizes because those frameworks are reusing the user's operating system's system web browser library.

How large is an Electron app?

Because Electron is essentially a “browser in a box,” every Electron app also comes with the Electron framework, which weighs in at an astonishing 120 MB. Because of how Electron works, you can't install the framework on your computer and then get all the other apps that use Electron to use it.

Why does Electron use so much memory?

Electron will use a ton of memory because it's running a full browser inside a browser/desktop, Chromium, along with running v8 and all of it's own code. Along with that Chromium is already known for high memory usage. So it's relatively normal to see high memory.


2 Answers

Here's a github issue on it.

The comment I'm emphasizing is:

That's the expected size, there is no way to make it smaller.

The reason why it's so big is because electron is loading most of chromium inside that 50mb file.

So no unfortunately there is no way to make it smaller sorry.

like image 130
Joshua Avatar answered Sep 23 '22 17:09

Joshua


A somewhat helpful post from that github thread suggests removing unnecessary node modules via electron-packager. It also offers a bit more explanation on why files are so large.

You can zip your app and if you're using electron-packager you can ignore some node modules that you don't need when the app is running, this makes it a bit smaller. For instance I have a 37MB zipped Electron app (Note Windows version is much larger as it contains a copy of Git). But Electron will always have a large part of Chrome in it so there is only so much that can be done. Electron itself right now is ~33MB.

like image 27
Brian Wright Avatar answered Sep 23 '22 17:09

Brian Wright