Reputation: 2729
I have built an electron app and packaged it using electron packager. I made windows bundle of 238MB and linux version is 450 MB. I compare this with visual studio code which is also electron app. They have relatively very low file size of 50 MB for windows and 60 to 70 MB for rpm and deb packages.
My app is a simple, whereas visual studio code has more functionalities.
I want to reduce file size, how to do this?
I have already seen this , I am not using electron build but electron packager. enter link description here
Here is cmd I use inside package.json
packagerLinux: electron-packager --out Linux64 --overwrite --platform linux
packagerWindows: electron-packager --out winx64 --overwrite --platform windows
Let me know if you need
Upvotes: 3
Views: 5324
Reputation: 440
i am currently having the same issue and i spent a lot of time trying to figure out how to reduce the size of my 250MB Hello World package in Windows, obtained using electron-packager.
There is a github issue on it. To sum up briefly, the main problem is that Electron apps require both NodeJS and Chromium to be installed in order to work, so Electron packages contain both, increasing a lot the size of the file. This appears to be a non solvable problem.
Meanwhile, you can try to build the app using npm run build --prod
, which reduces a bit the overall size of the folder.
Edit: i found out this package called modclean. It basically search your node_modules
folder for unnecessary files and remove them.
Simply install it with
npm install modclean --save //install locally
or
npm install modclean -g //install globally
and then launch it with modclean
or modclean -n default:safe
.
In this way i managed to reduce the size of my final folder of around 30MB. Not a lot, but still something :)
Upvotes: 7