electron-builder windows 和 linux 打包

使用的配置

{

"name": "web",

"version": "1.8.0",

"private": true,

"homepage": "./",

"main": "main.js",

"scripts": {

"serve": "vue-cli-service serve --open",

"start": "yarn serve",

"build": "vue-cli-service build",

"electron-start": "electron .",

"package": "electron-builder --publish never --win",

"package:linux": "electron-builder --publish never --linux",

"dev": "concurrently \"wait-on http://localhost:8080 && electron .\" \"cross-env BROWSER=none yarn start\""

},

"dependencies": {},

"devDependencies": {

"electron": "^8.2.1",

"electron-builder": "21.2.0"

},

"build": {

"appId": "Electron-desktop",

"productName": "Electron-desktop",

"copyright": "",

"directories": {

"output": "build"

},

"win": {

"target": [

"nsis"

],

"icon": "./dist/image/GuangFu.ico"

},

"linux": {

"target": [

"AppImage"

]

},

"extends": null,

"asar": true,

"nsis": {

"oneClick": false,

"allowToChangeInstallationDirectory": true,

"installerHeaderIcon": "./dist/image/HDLogo.ico",

"installerIcon": "./dist/image/HuoDian.ico",

"createDesktopShortcut": true

}

}

}

vue/react 项目桌面端

打包的流程是先将项目编译成生产版本,然后将打包后的生产版本再打包成桌面客户端

遇到问题及解决方法

项目路径含有中文字符,打包失败

electron-builder-err2_LI.jpg

在 windows 平台上打包 linux 失败,将项目迁移到 linux 环境上打包是成功

electron 打包太慢

打包过程需要下载相应的文件导致,可以提前下载好对应的文件并存到对应的位置中。

本文章由javascript技术分享原创和收集

发表评论 (审核通过后显示评论):