2

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

  • To unpack an asar file: https://stackoverflow.com/questions/38523617/how-to-unpack-an-asar-file – snwflk Jan 26 '21 at 16:12

1 Answers1

3

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

OverShifted
  • 457
  • 1
  • 7
  • 17
  • Yes I ran this command to unpack the file but it gives an error in the terminal saying "ENOENT: no such file or directory, open 'app.asar'" – Mahmoud Farargy Jan 26 '21 at 17:13
  • @MahmoudFarargy are you sure your working directory is the same as the directory that `app.asar` is located? you can change the working directory using the `cd` command. – OverShifted Jan 27 '21 at 06:23
  • Yes, when I specified the directory as you said, and ran the command, the file got extracted correctly. Thanks so much! – Mahmoud Farargy Jan 27 '21 at 07:13
  • And found out the node_modules folder is around 1.10GB which probably what makes the app so big. – Mahmoud Farargy Jan 27 '21 at 07:22
  • Thanks! And yes node_modules can get really heavy. There are even some memes about that. – OverShifted Feb 03 '21 at 13:18