electron框架(4.0)electron-builde和electron Forge的打包方式

----使用electron-builder打包(需要魔法)

--安装electron-builder:
npm install electron-builder -D
 --package.json中进行相关配置:
{
  "name": "video-tools",
  "version": "1.0.0",
  "main": "main.js",
  "scripts": {
    "start": "electron .",
    "build": "electron-builder"
  },
  "build": {
    "appId": "com.atguigu.video",
    "win": {
      "icon": "./logo.ico",
      "target": [
        {
          "target": "nsis",
          "arch": ["x64"]
        }
      ]
    },
    "nsis": {
      "oneClick": false,
      "perMachine": true,
      "allowToChangeInstallationDirectory": true
    }
  },
  "devDependencies": {
    "electron": "^30.0.0",
    "electron-builder": "^24.13.3"
  },
  "author": "xmr",
  "license": "ISC",
  "description": "A video processing program based on Electron"
}

----使用Electron Forge进行打包(推荐,无需魔法)

中文网也是用这个 

--执行第一条命令:

npm install --save-dev @electron-forge/cli

--执行第二条命令:

npx electron-forge import

--执行第三条命令:

npm run make

                                                       这就打包成功啦!!!

--运行程序的路径:

可运行程序在 my-electron-app\out\make\squirrel.windows\x64

你可能感兴趣的:(electron框架,electron,javascript,前端)