Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

electron 打包、发布 #27

Open
huangshuwei opened this issue May 21, 2019 · 0 comments
Open

electron 打包、发布 #27

huangshuwei opened this issue May 21, 2019 · 0 comments
Labels
electron 桌面应用

Comments

@huangshuwei
Copy link
Owner

huangshuwei commented May 21, 2019

electron 打包、发布

下面以windows 系统下为例

下载 electron 预构建二进制文件

根据你要发布的系统,选择下载对应的版本。

以 windows x64 为例。选择对应的版本。如 electron-v5.0.1-win32-x64.zip,解析文件

直接拷贝的方式发布

将源文件放到刚才解析的 electron/resources/app目录下,大致路径如下

electron/resources/app
├── package.json
├── main.js
└── index.html

双击 electron.exe启动

打包成 .asar文件方式发布

打包成 .asar文件可以避免源代码泄漏

全局安装 asar

$ npm install -g asar

打包你的项目
定位到你的应用程序,如文件夹名称为 your-app,执行打包命令

$ asar pack your-app app.asar

打包成功会生成 app.asar 文件,然后将此文件放到~electron/resources/app目录下。

双击 electron.exe启动

通过程序自动打包方式发布

未完...

@huangshuwei huangshuwei added the electron 桌面应用 label May 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
electron 桌面应用
Projects
None yet
Development

No branches or pull requests

1 participant