2

I have an Electron app (made with angular) and with this template: https://github.com/iffy/electron-updater-example

Every time I run the electron builder command, the app itself increases in size by a couple 10MB. It happens the same when I build in Windows or in Linux. The windows installer is currently on 337MB, it started at about 60MB.

Here is the scripts section from package.json:

"build": "npm run electron:serve-tsc && ng build",
"build:electron": "npm run build -- -c production --aot=true --build-optimizer=true --output-path=electron --base-href ./",
"electron:serve-tsc": "tsc -p tsconfig.serve.json",
"electron:build": "npm run build:electron && electron-builder build"

I run: npm run electron:build

Here are the electron settings:

 {
  "productName": "APP NAME",
  "compression": "maximum",
  "directories": {
    "output": "release/",
    "buildResources": "electron/"
  },
  "files": [
      "**/*",
      "electron",
      "!**/*.ts",
      "!*.code-workspace",
      "!LICENSE.md",
      "!package.json",
      "!package-lock.json",
      "!src/",
      "!e2e/",
      "!hooks/",
      "!angular.json",
      "!_config.yml",
      "!karma.conf.js",
      "!tsconfig.json",
      "!tslint.json"
  ],
  "publish": {
    "provider": "generic",
    "url": "https://example.com/downloads/"
  },
  "win": {
    "artifactName": "${productName} Setup.${ext}",
    "icon": "electron/assets/icons/electron",
    "target": [
      "nsis"
    ]
  },
  "mac": {
    "icon": "electron/assets/icons/electron",
    "target": [
      "dmg"
    ]
  },
  "linux": {
    "artifactName": "${productName} Setup.${ext}",
    "executableName": "APP NAME",
    "icon": "electron/assets/icons/electron",
    "target": {
      "target": "appimage",
      "arch": ["armv7l"]
    }
  },
  "nsis": {
    "installerIcon": "electron/assets/icons/electron/favicon.ico",
    "uninstallerIcon": "electron/assets/icons/electron/favicon.ico",
    "uninstallDisplayName": "${productName}",
    "runAfterFinish": true,
    "oneClick": false,
    "allowToChangeInstallationDirectory": true
  }
}

Does the builder require some sort of cleaning command? How can I stop the app from increasing size? Thank you very much for your help!

AlesSvetina
  • 403
  • 3
  • 6
  • 19

1 Answers1

0

Your build is probably generating files that are being incorporated into the new build due to a misconfiguration of one or both:

  • Failing to clean-up generated files
  • Accidentally including build folders in the paths that you've set Webpack to process
Slbox
  • 10,957
  • 15
  • 54
  • 106