Search code examples
electronelectron-builder

Electron image assets not accessible from build app


As a proof of concept, I have added a mobile phone image to my HomeComponent on my Angular Eclectron 19 app, that it's perfectly visible when I run it by npm start

<img src="../../assets/mobile.png" height="100" width="auto"/>

I have tried different additions to electron-builder.json

{
  "asar": true,
  "directories": {
    "output": "release/"
  },
  "files": [
    "**/*",
    "!**/*.ts",
    "!*.map",
    "!package.json",
    "!package-lock.json",
    {
      "from": "../dist",
      "filter": ["**/*"]
    }
  ],

or package.json, to make the assets folder available outside the asar build file.

Any idea about the needed configuration? Cheers

Images loaded on the packaged app.


Solution

  • Angular tends to solve that for you, did you try to use assets/mobile.png instead of ../../assets/mobile.png?