How to reduce the volume of applications packaged by Electron?

use the electron-vue template, and then package the application with electron-builder. The volume of exe has 66050KB, the project does not have many things, and the volume of the package feels larger. After checking, I see that some articles say that the application will be packaged and then distributed. I don"t understand what this means, or I still don"t know how to reduce the size of the application.


it doesn't matter if the installation package installed for the first time is a little bigger. The package typed by electron-builder is about 30-40m. The rest is mainly the size of the referenced node_modules file (you can see it with build_dir), and then you can delete the dependency pertinently.

if the application package needs to be distributed multiple times, you can try some methods to update incrementally without having to distribute the entire node_modules folder and Electron main process each time, which can also solve some of this problem

the installation package of Vscode is also about 40MB, which is compressed using its own packaging method, so there is no good way to install the package for the first time


electron = node.js + chromium, also has some special functional modules, such as ffmpeg,.

you can try to reduce the size of your application, such as packaging the main thread and rendering thread with webpack, but it may not have much impact on the whole project.

in addition, you can consider deploying the latter to platforms that support PWA in conjunction with PWA,.


https://zhuanlan.zhihu.com/p/.

Menu