Table of contents
1. Problem description
With the continuous iteration of the electron project, the packaged installation package is getting bigger and bigger. Everyone knows: electron
In the world of , there is a asar
concept of packaging. asar
The source code can be packaged into a file, and then a certain effect of code encryption and integration can be obtained. However, by default, the asar
files inside are packaged indiscriminately. Some useless files will be packaged in, and even some additional third-party programs. In order to reduce the size of the installation package, the ignore parameter is configured. The ignore parameter is within the scope of the default package and excludes some that are not packaged. After installing the reduced version of the installation package, the startup project reports Error: Unable to find a valid app mistake
2. Problem solving
Filter out the files that are not packaged, analyze it carefully, extract app.asar through asar extract app.asar ./, and find that there is no package.json in it, put package.json in it and use asar pack ./ App.asar regenerates a new app.asar, it's ok
The package.json file must be included in the source directory
Decompress and compress the app.asar file into an app.asar file, see the following article
How to decompress electron's app.asar
How to reduce the size of the installation package of electron