Portable windows app built with electron-builder takes too long to start up

59 Views Asked by At

I have used electron-builder to package my React + Django application into a single executable file. When I build the app, the resulting dist folder contains:

-- dist (folder generated after building the app with electron)
|
|- MyApp0.0.1.exe (portable exe file)
|
|- win-unpacked
|    |
|    |-MyApp.exe
|    |-multiple_folders (dependencies of the MyApp.exe)
|    |-multiple_files (dependencies of the MyApp.exe)

The problem is the following:

  • When runnning the MyApp.exe inside the win-unpacked folder, and as long as the dependency files/folders are at the same level, the app works perfectly fine and takes less than a second to startup and display. It even asks for admin password, as in the package.json config it is specified to build it with "requestedExecutionLevel": "highestAvailable".
  • When running the MyApp0.0.1.exe which is supposed to be the portable, standalone .exe file for the application, although it does run perfectly fine, it takes up to 6 minutes to start-up and display the app.

I have tried skimming down the project as much as possible in terms of the node_modules that I need, removing large data files not needed, ...

I am clueless as to why this is happening. I am not a web-dev expert in any way but I find such a stark difference between startup time to be excessive/worrying.

What am I missing here? Here's the electron-builder config of my package.json for reference.

"electron-build-win": "npm run build && electron-builder --win portable"
.
.
.

"build": {
    "appId": "com.electron.MyApp",
    "productName": "MyApp",
    "asar": true,
    "win": {
      "icon": "./public/assets/icons/logo.png",
      "requestedExecutionLevel": "highestAvailable"
    },
    "files": [
      "build/**/*",
      "./public/electron.js",
      "package.json"
    ],
    "directories": {
      "buildResources": "public"
    },
    "extraFiles": [
      {
        "from": "dist-django",
        "to": "dist-django",
        "filter": [
          "**/*"
        ]
      }
    ],
    "extends": null
  }
0

There are 0 best solutions below