Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expected app bundle size? #2003

Closed
mattotodd opened this issue Jun 18, 2015 · 89 comments
Closed

Expected app bundle size? #2003

mattotodd opened this issue Jun 18, 2015 · 89 comments

Comments

@mattotodd
Copy link

When building the latest 0.27.3 the mac app bundle is about 142MB of which 136MB come from the Electron Framework.

Is there any way to make this package smaller?

@zcbenz
Copy link
Member

zcbenz commented Jun 19, 2015

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

@zcbenz zcbenz closed this as completed Jun 19, 2015
@carlosperate
Copy link

Is it really expected to be that large? my bundled windows and linux builds are much smaller, and looking into the Electron Framework folder, there are three copies of the Electon Framework file, one on each:

Contents\Frameworks\Electron Framework.framework
Contents\Frameworks\Electron Framework.framework\Versions\A
Contents\Frameworks\Electron Framework.framework\Versions\Current

Are these supposed to be symbolic links?

@erezcohen
Copy link

How small are the Windows and Linux builds?

@davefedele
Copy link

I am also wondering about this. Here are the sizes for my electron app:

      osx - 117.3 mb
  linux32 -  60.3 mb
  linux64 -  55.2 mb
 win ia32 -  47.8 mb
  win x64 -  66.2 mb

Thanks!

@znation
Copy link

znation commented Aug 28, 2015

Is there a plan to try to reduce the size of the framework in future releases? This makes it hard to justify using Electron for small apps (where the size of the app itself would be dwarfed by the size of Electron).

@carlosperate
Copy link

I can confirm that my electron app bundles are about the same size as @davefedele.

@jlord
Copy link
Contributor

jlord commented Sep 4, 2015

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.

@anaisbetts
Copy link
Contributor

OS X compressed is similarly sized to other platforms which probably means that the app you're using to measure sizes is perhaps misinterpreting symlinks?

@carlosperate
Copy link

In my case I am using an electron-boilerplate that does not use electron-packager and my electron app folder gets zipped with a python script and distributed via aws s3. So my first though was that the symlinks were not respected when compressing (rather than the file size being misinterpreted).

I'll have to look into it, is there anywhere a list of the symlinks present? I have very limited access to a mac computer (I use a CI server to pack my app for each platform).

@anaisbetts
Copy link
Contributor

paul@psamathe:/Applications/Slack.app% find . -type l
./Contents/Frameworks/Electron Framework.framework/Electron Framework
./Contents/Frameworks/Electron Framework.framework/Libraries
./Contents/Frameworks/Electron Framework.framework/Resources
./Contents/Frameworks/Electron Framework.framework/Versions/Current
./Contents/Frameworks/Mantle.framework/Headers
./Contents/Frameworks/Mantle.framework/Mantle
./Contents/Frameworks/Mantle.framework/Modules
./Contents/Frameworks/Mantle.framework/Resources
./Contents/Frameworks/Mantle.framework/Versions/Current
./Contents/Frameworks/ReactiveCocoa.framework/Headers
./Contents/Frameworks/ReactiveCocoa.framework/Modules
./Contents/Frameworks/ReactiveCocoa.framework/ReactiveCocoa
./Contents/Frameworks/ReactiveCocoa.framework/Resources
./Contents/Frameworks/ReactiveCocoa.framework/Versions/Current
./Contents/Frameworks/Squirrel.framework/Headers
./Contents/Frameworks/Squirrel.framework/Modules
./Contents/Frameworks/Squirrel.framework/Resources
./Contents/Frameworks/Squirrel.framework/Squirrel
./Contents/Frameworks/Squirrel.framework/Versions/Current

@carlosperate
Copy link

I was finally able to look into this yesterday, and indeed my issue was caused by symlinks not being preserved. So my application size drastically shrunk from ~110Mbs, to ~45Mbs.

@Kadrian
Copy link

Kadrian commented Sep 16, 2015

@carlosperate Can you describe how you fixed your symlinks?

@carlosperate
Copy link

Well, it is important to emphasise that I am not using electron-packager. I had a python "build script" (same script runs in windows, linux and os x) that would build other stuff independent to my electron app, then if running on mac it would copy everything into the general OS X app bundle directories, and finally zip everything into a single file.

So, in my specific case there were two issues with my script, I was copying the electron files without respecting symlinks (very easy to fix), and then the zipfile module in Python was not respecting the symlinks either, which was not as easy as I expected. If you google solutions to the problem you'll find a few articles with odd implementations that were closer to magic than a real explanation, so after some time unsuccessfully trying to get it to work I ended up just running a subprocess that executes the os x zip CLI command with the required flags for respecting symlinks.

@smhg
Copy link

smhg commented Nov 17, 2015

FWIW, when creating a zip on Linux for distribution to OS X, you'll have to use the -y parameter to correctly handle symlinks:

$ zip -r -y app.zip app

@iamnewspecies
Copy link

What has #SLACK done? Why is their app so small?
The zip archive file is 24.6 MB.

@carlosperate
Copy link

The Windows and linux versions are more or less what I'd expect, I wonder how they've got their OSX version so small.

@mattotodd
Copy link
Author

mattotodd commented Apr 15, 2016

Last I checked slack were using MacGap for the mac side

@iamnewspecies
Copy link

http://electron.atom.io/#built-on-electron Slack is there in the list.

@joshaber
Copy link
Contributor

Yes, Slack's Windows and Linux apps are built on Electron, but the Mac app uses MacGap.

@sgarbesi
Copy link

@joshaber I think you're correct. The Slack mac app is only ~36 MB.

seckie pushed a commit to seckie/jsmetronome that referenced this issue Jul 2, 2016
@leonelcbraz
Copy link

Do you guys know if Electron has any plan for reducing the final bundle size? That'd be incredible.

@baconbrad
Copy link
Contributor

baconbrad commented Jul 26, 2016

Do you guys know if Electron has any plan for reducing the final bundle size? That'd be incredible.

There is only so much you can take out of Chromium, Node.js, V8, etc and still have a working product. Unfortunately since everything is patched in order to work it isn't as easy as making it use standalone versions of each to cut down on the size. I am sure the Electron team would like a smaller size. But you just can't plan and make it happen. It is just too caustic on the overall project to go in thinking you can remove even 10-20 megs of code and resources and expect everything to run stable.

@leonelcbraz
Copy link

So true @baconface... One thing though has helped me out here: I was putting modules like electron-prebuilt, electron-builder and electron-packager and all their dependencies in the "app" folder. Cutting them off from app's package.json and building again saved me a lot of size. I used the two-package.json structure from electron-builder.

@karimhossenbux
Copy link

One thing I saw when moving more dependencies to devDependencies, the more time it needs to build it.

✔ building main process
- building renderer process

It spent a lot more time on "building renderer process", and the animated icon stop like it crashes but it didn't. Then it show 203778ms from the renderer report.

Moving devDependencies back to dependencies, build time is normal again but app is big.

If I'm not having any error during build, it means it's all good right?

@baconbrad
Copy link
Contributor

@karimhossenbux This is normal for me. There is a walk function in electron-packager that goes through all the dependencies to determine if they should be there or not. With the new flat style dependencies instead of the nested it will take a lot longer to determine unneeded dependencies. As far as I know there is no way to get around the extra build time.

@karimhossenbux
Copy link

@baconbrad Thank you! I'm using electron-builder but I guess it works the same way.

@Rafi993
Copy link

Rafi993 commented Mar 25, 2018

Is there any electron package builder that includes only your source and download others (only necessary for the current operating system user runs on) when the user runs your app for the first time ?. It would make it easy for distribution and should reduce your app size considerably.

@lukepighetti
Copy link

Electron, please do not go the "ERE" route. Yes, I know you are bloated, but I love how people can download my application and it just runs great without having to screw around with installing deps, updating the runtime environment, or any of that nonsense that I thought we got rid of circa 2003.

@rkyoku
Copy link

rkyoku commented May 25, 2018 via email

@zcmgyu

This comment has been minimized.

@baconbrad

This comment has been minimized.

@stephanebouget
Copy link

If your application is more than 100MB,
it may be that your exe includes a good part of your node_modules folder.
Note that everything declared in package.json in dependencies is imported back into the final executable.
(Very simple to verify: it is enough to decompile the executable)
So remember to define only the essential libs in dependencies (electron-log, electron-updater) and add all the other libs in devDependencies.

Your app will then "only" 50MB ...

@ghost
Copy link

ghost commented Aug 5, 2020

My app is little- here's the repo. The latest experimental version weights about 700mb
https://github.com/DeltaStudioApp/Delta-Studio/tree/experimental

@gzx-miller
Copy link

I am also wondering about this. Here are the sizes for my electron app:

  osx - 117.3 mb

linux32 - 60.3 mb
linux64 - 55.2 mb
win ia32 - 47.8 mb
win x64 - 66.2 mb
Thanks!

Amazing! Could you share about how to reduce electron app to so small size.

@GilbertoTADS
Copy link

@RenaudParis

isso é uma notícia triste ... Eu pessoalmente não me importo muito com um arquivo de 40 MB, mas 120 MB (como eu ouvi), no entanto, é um pouco demais para um hello world.

120 MB é descompactado, se você compactar fica em torno de 40 MB. Por exemplo, o VSCode de 64 bits para a instalação do Windows EXE tem cerca de 42,8 MB.

Pessoalmente, como usuário, eu sempre preferiria ter um aplicativo independente sem a necessidade de gerenciar o JRE (ou ERE) global, mesmo se eu tiver que baixar 200 MB em vez de 10 MB.

@mvladic , como faço para compactar meus arquivos no electron-forge? Estou com o mesmo problema e no electron sou iniciante.

@GilbertoTADS
Copy link

Eu também estou pensando sobre isso. Aqui estão os tamanhos do meu aplicativo de elétrons:

  osx - 117,3 MB

linux32 - 60,3 MB
linux64 - 55,2 MB
win ia32 - 47,8 MB
win x64 - 66,2 MB
Obrigado!

@davefedele , como fez para que seus arquivos tivessem em média 50mb ? Os meus estão em torno de 100-150mb.

@ghost
Copy link

ghost commented Mar 16, 2021

Eu também estou pensando sobre isso. Aqui estão os tamanhos do meu aplicativo de elétrons:

  osx - 117,3 MB

linux32 - 60,3 MB
linux64 - 55,2 MB
win ia32 - 47,8 MB
win x64 - 66,2 MB
Obrigado!

@davefedele , como fez para que seus arquivos tivessem em média 50mb ? Os meus estão em torno de 100-150mb.

Maybe he bundles the files? I'm not sure tho.

@ghost
Copy link

ghost commented Mar 16, 2021

@RenaudParis

isso é uma notícia triste ... Eu pessoalmente não me importo muito com um arquivo de 40 MB, mas 120 MB (como eu ouvi), no entanto, é um pouco demais para um hello world.

120 MB é descompactado, se você compactar fica em torno de 40 MB. Por exemplo, o VSCode de 64 bits para a instalação do Windows EXE tem cerca de 42,8 MB.
Pessoalmente, como usuário, eu sempre preferiria ter um aplicativo independente sem a necessidade de gerenciar o JRE (ou ERE) global, mesmo se eu tiver que baixar 200 MB em vez de 10 MB.

@mvladic , como faço para compactar meus arquivos no electron-forge? Estou com o mesmo problema e no electron sou iniciante.

You can:
Bundle them - using webpack, esbuild, pax...
Enable ASAR - builtin to electron, but you need to enable it in electron forge first.

@dumitruPuggle
Copy link

I have an idea how we can reduce the size of the Electron application. We can make it so that Electron is installed once on the computer, along with Node.js and all the necessary dependencies, and then just ship the application with the necessary source code, which will eventually be executed by the local Electron. Sort of like a Java application.

@ghost
Copy link

ghost commented May 11, 2022

I have an idea how we can reduce the size of the Electron application. We can make it so that Electron is installed once on the computer, along with Node.js and all the necessary dependencies, and then just ship the application with the necessary source code, which will eventually be executed by the local Electron. Sort of like a Java application.

That's been suggested many times, and no, it won't be done.

@RichardGuesso
Copy link

O que o #SLACK fez? Por que o aplicativo deles é tão pequeno? O arquivo zip é de 24,6 MB.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests