I use the latest Electron version 10.0.3 and created a target for app and mas (mac-app-store) and I struggle with the size of the app it created.
I found already a few blog posts which cover the topics, but my app size is so unusually high, that I couldn't pinpoint the cause for my situation.
Here is a list of the sizes:
target: app
- Electron Framework (130 MB)
- app.asar (462 MB)
target: mas:
- Electron Framework (130 MB)
- app.asar (1.1GB)
Please note, that in the mas build the app.asar is double the size. First I assumed it now also compiles for the new arm64 architecture, but it's just the x86_64. What could be the reason for these huge app sizes, and why is mas double the size?
The big size of the asar archive is most likely related to the node modules you are using
You can extract app.asar like this
Then you can use a tool like WinDirStat on the extracted folder to determine the guiltiest modules and you can perhaps remove or replace them
You can also use modclean before packaging to delete unneeded junk that sometimes is included in some modules
Also, make sure to install modules that are only needed in development as
devDependenciesso thatelectron-builderwon't package them.electronfor example, should be indevDependencies