Electron-builder: Cannot get app.getName to display productName

Created on 6 May 2017  路  3Comments  路  Source: electron-userland/electron-builder


  • electron 1.6.8:
  • electron-builder 17.3.1:

  • mac:

I am using the 2-package.json structure and am trying to set the app name to a friendly name for my app so app.getName() will return it instead of "Electron". I've tried setting it in several places, but no matter what I do, when I run npm run dev, app.getName() always returns Electron. Where should productName be in the package.json file(s) to override the app name properly? On mac, I want the first menu item to be my app's name instead of "Electron".

I've tried in the root of ./package.json:

{
  "name": "myapp",
  "productName": "My App"
}

and in the build object:

  "build": {
    "productName": "My App"
  }

I've tried in ./app/package.json:

{
  "name": "myapp",
  "productName": "My App"
}

Thanks

mac question

Most helpful comment

Disregard - when I run npm run dev it displays "Electron" as the first menu item, but when I build the mac .app it correctly displays my app name.

All 3 comments

After reading this section, it seems like I have to modify the Info.plist file, but I don't see a way to do that. I see Info.plist in node_modules/electron/dist/Electron.app/Contents/Info.plist, but I don't know how to modify that from my code or if I can override it somehow.

Disregard - when I run npm run dev it displays "Electron" as the first menu item, but when I build the mac .app it correctly displays my app name.

Is there any way to get 'run dev' to display the right app name?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

leo picture leo  路  3Comments

popod picture popod  路  3Comments

philcockfield picture philcockfield  路  3Comments

ccorcos picture ccorcos  路  3Comments

omarkilani picture omarkilani  路  3Comments