1

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?

Dev Minty
  • 64
  • 6
  • Please [edit] your question and include the complete error regarding `dist/index` you're getting. Thanks! Also, you probably shouldn't directly publish to GitHub upon trying to debug your packaging script. – Alexander Leithner Jun 30 '22 at 12:46
  • I'm publishing it to github because if I don't, this script doesn't generate ``lates.yml`` file but only ``builder-debug.yml`` which I need for auto updating. – Dev Minty Jun 30 '22 at 13:49

1 Answers1

1

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/*"
    ]
},
...
Dev Minty
  • 64
  • 6