Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set Electron favicon with electron-builder

I would like set new favicon in my Electron App and replace default Electron icon when my app is build.

I use electron-builder package. In the doc, i see the icons need to be placed in the build directory. So :

enter image description here

And when i build my app, i've this message :

Application icon is not set, default Electron icon will be used.

Anyone can help me ?

Part of my package.json :

  "scripts": {
    "postinstall": "install-app-deps && npmpd",
    "pre-build": "./node_modules/.bin/electron-rebuild",
    "build-bcrypt": "npm rebuild bcrypt --update-binary",
    "develop": "npm run private:compile -- --source-maps true && run-p -r private:watch private:serve",
    "test": "mocha -R spec --compilers js:babel-core/register test/**/*.spec.js",
    "lint": "eslint --no-ignore scripts app test *.js",
    "pack": "run-s private:clean private:compile private:build:all",
    "pack:mac": "run-s private:clean private:compile private:build:mac",
    "pack:win": "run-s private:clean private:compile private:build:win",
    "pack:linux": "run-s private:clean private:compile private:build:linux",
    "private:build:all": "build -mwl",
    "private:build:mac": "build --mac",
    "private:build:win": "build --win",
    "private:build:linux": "build --linux",
    "private:watch": "npm run private:compile -- --source-maps true --watch --skip-initial-build",
    "private:serve": "babel-node scripts/serve.js",
    "private:compile": "babel app/ --copy-files --out-dir build",
    "private:clean": "rimraf build",
    "private:cleandb": "rm -rf ./categories ./presentations ./slides ./users"
  },
  "build": {
    "win": {
      "icon": "build/icon.ico"
    }
  }
like image 530
s-leg3ndz Avatar asked Nov 13 '17 11:11

s-leg3ndz


2 Answers

In package.json, under the win key, you also need to specify the icon path:

"build": {
  "win": {
    "icon": "build/app.ico"
  }
}
like image 146
laurent Avatar answered Oct 18 '22 01:10

laurent


Had similar issue, i added directories to my build

    "build":{
    "directories": {
              "buildResources": "resources"
            }
}

and inside the directories folder i had my icon.ico file

like image 33
Arinze Ogbonna Avatar answered Oct 18 '22 02:10

Arinze Ogbonna