Search code examples
vue.jselectronelectron-builderelectron-packager

How to reduce electron apps size


My electron application is insanely big on Mac after installation. It's around 1.39GB for no apparent reason, even though it's around 70MB on Windows. I tried to unpack the dmg file to see what makes it so big then found a file called app.asar that takes a large size of the app (1.22GB) and I don't know how to unpack this file. So my question is, How to make the application's size much smaller like on windows? and what does app.asar file contain?

I'm using electron-builder to build the app by the way


Solution

  • It depends on your app. If your app is too heavy, then it might be natural. If not; try removing unwanted packages in the node_modules directory using npm. Try instructions here :

    https://www.electronjs.org/docs/tutorial/application-distribution

    Make electron app smaller?

    https://github.com/electron/electron/issues/2003

    You can also unpack the asar file using:

    npx asar extract app.asar destfolder
    

    more on that here How to unpack an .asar file?

    it basically contains all you code and stuff.

    I hope I could help you 😉.

    some stuff added based on others comments