Electron使用electron-packager打包记录
1.使用 JavaScript, HTML 和 CSS 构建跨平台的桌面应用
2.下载https://github.com/electron/electron-quick-start中的示例
3.在示例目录下本地安装electron、以及electron-packager
npm install electron --save-dev
npm install electron-packager --save-dev
4.修改package.json文件:
{
"name": "electron-quick-start",
"version": "1.0.0",
"description": "A minimal Electron application",
"main": "main.js",
"scripts": {
"start": "electron .",
"package": "electron-packager ./ --win --out ./OutApp --arch=x64 --electron-version=1.8.2 --asar"
},
"repository": "https://github.com/electron/electron-quick-start",
"keywords": [
"Electron",
"quick",
"start",
"tutorial",
"demo"
],
"author": "GitHub",
"license": "CC0-1.0",
"devDependencies": {
"electron": "^1.8.2",
"electron-packager": "^12.1.0"
}
}
5.在该目录执行cmd命令:npm start 即可查看效果
6.执行:npm package 即可在目录生成打包文件