1$ pnpm add asar -g
2$ asar extract /[sourcePath]/app.asar /[targetPath]/  # Extract asar

After extraction, the contents are as follows:

  1. Unnecessary Locales: Remove unused language packs in the locales directory.

    1// Set language pack before whenReady
    2app.commandLine.appendSwitch('lang', 'en-US');
    3await app.whenReady()
    
  2. Dependencies: Ensure that development dependencies are not listed as production dependencies.

  3. File Locking: If Electron-builder prompts that app.asar is occupied, close VS Code.

ogImage: https://image.coldcoding.top/file/AgACAgQAAyEGAASUgNIDAAOdZ-LLW2SY1yk2VuSGbtbqq3iEFT4AAgPGMRuknBlTlzRoYu-UvNoBAAMCAAN3AAM2BA.jpg