Electron打包应用

2019-10-22 17:29:15 浏览数 (1)

步骤

下载官方的Demo

代码语言:javascript复制
git clone https://github.com/electron/electron-quick-start
cd electron-quick-start
npm install // 或者 yarn install
npm start

electron-packager打包

安装依赖

代码语言:javascript复制
npm install electron-packager --save-dev

win

代码语言:javascript复制
"scripts": {
    "electron_build": "electron-packager ./ --platform=win32 --arch=x64 --overwrite"
}

electron-builder打包

代码语言:javascript复制
npm install electron-builder --save-dev

package.json中做如下配置

代码语言:javascript复制
"build": {
    "appId": "com.xxx.app",
    "mac": {
      "target": ["dmg","zip"]
    },
    "win": {
      "target": ["nsis","zip"]
    }
},
"scripts": {
    "dist": "electron-builder --win --x64"
},

0 人点赞