electron-builder icon indicating copy to clipboard operation
electron-builder copied to clipboard

Win .exe very big size

Open ruben-cruz opened this issue 5 months ago • 4 comments

  • Electron-Builder Version: 22.2.0
  • Node Version: 16.15.1
  • Electron Version: 7.1.9
  • Electron Type (current, beta, nightly): current
  • Target: win portable

I'm building a small windows portable app to include inside a CD/DVDs and the generated .exe file is about 45mb. I need to generate a smaller .exe to increase the app start performance inside the CD.

Does anyone know if it's possible to generate smaller .exe portable files? If so, how can we do that?

My package.json only has the following dependencies:

"devDependencies": {
    "asar": "^3.2.0",
    "electron": "^7.1.9",
    "electron-builder": "^22.2.0",
    "electron-packager": "^14.2.0",
    "javascript-obfuscator": "^4.1.0"
  },
  "dependencies": {
    "electron-pdf-window": "^1.0.12",
    "fs-extra": "^8.1.0",
    "systeminformation": "^4.19.1",
    "v8-compile-cache": "^2.1.0"
  },

ruben-cruz avatar Jan 12 '24 17:01 ruben-cruz

I can't support earlier versions of electron-builder due to the way the versioning/release CI works on this monorepo. Can you first try the most recent 24.6.x version of electron builder first?

AFAIK, portable exe files need to have all package files included. The alternative is to use nsis-web target, but then you lose the portable nature of the application.

Best guess as a workaround is to have your large assets stored elsewhere and either copied from the disc or downloaded from a server on first app launch.

mmaietta avatar Jan 12 '24 18:01 mmaietta

@mmaietta I've updated the electron-builder to v24.9.1, then generated a new portable, but the .exe size remains the same (~45mb).

I think I understood your suggestion, but the problem is that my app can be opened using a computer without network/internet connection. So, the assets should be stored inside the cd/dvd.

Do you know if it's possible to generate a portable .exe with some assets outside the app? In order to decrease the app .exe size...

ruben-cruz avatar Jan 12 '24 21:01 ruben-cruz

Does anyone have any suggestions on this?

ruben-cruz avatar Jan 16 '24 14:01 ruben-cruz

I don't think this question/issue is really the scope of electron-builder. You might get somewhere asking on a subreddit, search StackOverflow (here's an example answer) or direct it towards Electron themselves, but I think Electron is not the most performant or smallest package, and that's accepted sacrifice for ease of creating a simple to setup desktop program.

45 MB is not large, CDs and DVDs can hold this size of a file easily.

tendermario avatar Jan 28 '24 08:01 tendermario