Packaging your app into an asar archive speeds up requires a bit, it conceals the source code and helps to avoid long path names on Windows. Asar is an archive format that concatenates files together without compression.
I got this error when building a Windows installer for an electron app with electron winstaller:
"The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters."
This was because of a package in node_modules that created very long paths.This did however work on Linux and MacOS. The solution was to package my app with asar before creating the installer.
Asar and electron packager
Install the asar package globally:
In the Electron tutorial app we use electron packager. To the build script we can pass –asar=true in package.json:
So now when we do a npm run package-mac our app will have a file called app.asar in it instead.
You can also do this without electron packager with this command:
Read the official docs about electron and asar to get to know more.
Next tutorial shows you how to create a dmg-installer for macOS