我有一个Electron应用程序,它不会在DMG版本中显示背景图像。我的package.json(顶级)包含:
"pack": "build --dir",
"dist": "build"
我的“build”目录也有一个有效的“background.png”。还需要配置什么?
答案 0 :(得分:0)
上面的配置是正确的。如果配置了非默认的OS X安装文件夹,电子构建器中的某个点就会出现错误,导致后台不显示。
答案 1 :(得分:0)
PKG 内置电子生成器
的更新
package.json
"build": {
"appId": "com.audio.application",
"productName": "Audio-App",
"artifactName": "${productName}-Setup-${version}.${ext}",
"copyright": "Copyright © 2020 Audio Corp",
"mac": {
"category": "com.audio.application",
"target": [
"pkg"
],
"icon": "dist",
"identity": "identity",
"darkModeSupport": true,
"hardenedRuntime": true,
"gatekeeperAssess": false,
"artifactName": "${productName}.${ext}"
},
"pkg": {
"scripts": "../build/pkg-scripts",
"installLocation": "/Applications",
"background": {
"file": "build/icon/background.png",
"alignment": "bottomleft"
},
"allowAnywhere": true,
"allowCurrentUserHome": true,
"allowRootDirectory": true,
"license": "build/license.html",
"welcome": "build/resources/welcome.txt",
"conclusion": "build/resources/conclusion.txt",
"isVersionChecked": true,
"isRelocatable": false,
"overwriteAction": "upgrade"
},
"directories": {
"buildResources": "release",
"output": "release"
}
},
构建目录的文件夹结构-
(位于项目的根目录)
背景(数据类型: PkgBackgroundOptions )
PkgBackgroundOptions
BackgroundAlignment
BackgroundScaling
参考:pkgOptions