Search code examples
electronelectron-builderasar

Electron-builder doesnt generate dist files


I'm trying to build an installer with electron-builder but every time I generate the installer and install my application, I get an error that "dist/index" doesn't exist in .asar file. I checked and no dist file is packed inside .asar.

The error I'm getting:

Not allowed to load local resource: file:///C:/Users/user1/AppData/Local/Programs/myApp/resources/app.asar/dist/index.html

I'm building with this script: "publish": "set GH_TOKEN=<my_token> && electron-builder --win -p always"

Does electron-builder have any flags to tell him where to put the output files?


Solution

  • Okey after some trial and error, I found what was wrong... So basically my package.json was configured wrong. In order to include dist in build it must be specified like this:

    ...
    "build": {
        "appId": "si.app.testing",
        ...
        "directories": {
            "output": "release",
            "buildResources": "dist"
        },
        "files": [
            "**/*",
            "dist/**/*",
            ...
            "!.github",
            "!.vs",
            "!node_modules/*"
        ]
    },
    ...