electron builder app size is too large

Arun Krishnan picture Arun Krishnan · Dec 18, 2017 · Viewed 7.3k times · Source

I find that the MyApp.exe file generated using electron-builder is nearly about 500M. I am not sure what I did because previously, just for ia32 or x64, it would be around 196M. I also looked at this link and it mentions only about 55MB-60MB. So the question is, why am I getting such large sizes for my exe files? My app itself is very small and if electron is only around 33MB, what's all that extra space there?

Here are my package.json entries:

"build": {
"appId": "com.electron.myApp",
"publish": [
  {
    "provider": "generic",
    "url": "https://myAppServer"
  }
],
"win": {
  "target": [
    {
      "target": "nsis",
      "arch": [
        "ia32"
      ]
    }
  ]
},
"asar": false,
"nsis": {
  "oneClick": true,
  "perMachine": false,
  "artifactName": "${productName}-Setup-${version}.${ext}"

}    
"devDependencies": {
 "electron": "^1.7.9",
 "electron-installer-windows": "^0.2.0",
 "electron-builder": "^19.45.5",
 "electron-packager": "^8.5.2",
 "electron-winstaller": "^2.5.2",
 "grunt-electron-installer": "^2.1.0"
},
"dependencies": {
 "auto-launch": "^5.0.1",
 "cron": "^1.2.1",
 "electron-config": "^0.2.1",
 "electron-positioner": "^3.0.0",
 "electron-squirrel-startup": "^1.0.0",
 "electron-window": "^0.8.1",
 "electron-updater": "^2.16.1",
 "fs": "^0.0.1",
 "homedir": "^0.6.0",
 "https": "^1.0.0",
 "https-proxy-agent": "^1.0.0",
 "line-by-line": "^0.1.5",
 "pac-proxy-agent": "^1.0.0",
 "url": "^0.11.0",
 "winreg": "^1.2.3",
 "xml2js": "^0.4.17"
} 
}

Is this the expected size of an electron app? Any way to make this smaller?

Regards, Arun

Answer

Mert Simsek picture Mert Simsek · Dec 18, 2017

You can try npm prune --production but even the most minimal Electron application is going to be around 100MB.