Electron packaging process

1. Install electron-builder

npm install  electron-builder --save-dev

2. Configure electron-builder related parameters in the package.json file of the project

{
  "name": "electron-quick-start",
  "version": "1.0.0",
  "description": "A minimal Electron application",
  "main": "main.js",
  "scripts": {
    "start": "electron .",
    "build": "electron-builder"
  },
  "build": {
    "appId": "com.imaxue.app",
    "productName":"yangyi",
    "win": {
      "icon": "build/favicon.ico",
      "target": [
        "nsis"
      ]
    },
    "nsis": {
      "oneClick": false,
      "perMachine": true,
      "allowToChangeInstallationDirectory": true
    }
  },
  "repository": "https://github.com/electron/electron-quick-start",
  "keywords": [
    "Electron",
    "quick",
    "start",
    "tutorial",
    "demo"
  ],
  "author": "GitHub",
  "license": "CC0-1.0",
  "devDependencies": {
    "electron": "^8.2.5",
    "electron-builder": "^22.6.1"
  },
  "dependencies": {
    "bootstrap": "^4.5.0",
    "electron-store": "^5.1.1",
    "uuid": "^8.1.0"
  }
}
  • Note that if there is a problem with the download source, you can add it to the build
    "electronDownload":{
      "mirror":"https://npm.taobao.org/mirrors/electron/"
    },

3. Execute the packaging command

npm run build

4. Complete

After completion, the dist directory will be generated under the project directory

 

Guess you like

Origin blog.csdn.net/m0_37572422/article/details/106386611