How to deploy an Electron app as an executable or installable in Windows?

后端 未结 9 1420
渐次进展
渐次进展 2020-11-30 20:14

I want to generate a unique .exe file to execute the app or a .msi to install the application. How to do that?

9条回答
  •  忘掉有多难
    2020-11-30 20:39

    2020 Update You can use electron-builder to create portable .exe file for your electron app. All you need to do is install electron-builder with yarn add electron-builder --dev Then create a package.json file like this(this is just for portable .exe):

    {
      "name": "my-electron-app",
      "productName": "electron app",
      "version": "1.0.0",
      "description": "an electron app",
      "main": "main.js",
      "scripts": {
        "start": "electron .",
        "dist": "electron-builder"
      },
      "devDependencies": {
        "electron": "^8.0.2",
        "electron-builder": "^22.3.2"
      },
      "build": {
        "appId": "com.electron.app",
        "win": {
          "target": "portable"
        },
        "portable": {
          "unicode": false,
          "artifactName": "my_electron_app.exe"
        }
      }
    }
    

提交回复
热议问题