(大多数情况下)我成功使用了electron-builder
。我正在构建.dmg和NSIS安装程序.exe。 .dmg为@ 200 mb,而安装程序.exe为@ 50mb。我在OSX应用程序的“目录”目录中进行了挖掘,以查看是否包含了一些不应该包含但没有发现明显内容的东西。
是否存在大小差异的正当理由,或者我应该在实施和/或使用electron-builder
时继续寻找问题?
我的package.json文件在下面。
{
"name": "xxxxxxxx",
"version": "1.0.0-beta.7",
"description": "xxxxxxxx",
"productName": "xxxxxxxx",
"main": "main.js",
"scripts": {
"start": "APP_DEV=true electron .",
"package": "electron-packager . --version=0.35.6 --overwrite --out=release-builds",
"package-mac": "electron-packager . --overwrite --platform=darwin --arch=x64 --prune=true --out=release-builds",
"package-win": "electron-packager . --overwrite --platform=win32 --arch=x64 --prune=true --out=release-builds",
"postinstall": "install-app-deps",
"pack": "build --dir",
"dist": "build -mw"
},
"build": {
"appId": "xxxxxxxx",
"productName": "xxxxxxxx",
"copyright": "xxxxxxxx",
"asar": true,
"mac": {
"hardenedRuntime": true,
"entitlements": "build/entitlements.mac.plist",
"entitlementsInherit": "build/entitlements.mac.plist",
"gatekeeperAssess": false,
"target": [
"dmg"
],
"icon": "build/osx.png",
"category": "public.app-category.business",
"compression": "store",
"files": [
"!release-builds/*",
"!build/*",
"!.vscode/*",
"!.gitignore/*"
]
},
"dmg": {
"sign": false,
"background": "build/osx-bng.png",
"icon": "build/osx.png",
"iconTextSize": 14,
"iconSize": 80,
"window": {
"x": 100,
"y": 100,
"width": 600,
"height": 452
},
"contents": [
{
"x": 160,
"y": 250
},
{
"x": 430,
"y": 250,
"type": "link",
"path": "/Applications"
}
]
},
"nsis": {
"createDesktopShortcut": "always",
"oneClick": false,
"perMachine": false,
"allowElevation": true,
"allowToChangeInstallationDirectory": true,
"installerIcon": "build/icon.ico",
"uninstallerIcon": "build/icon.ico",
"installerHeaderIcon": "build/icon.ico",
"installerSidebar": "build/installerSidebar.bmp",
"uninstallerSidebar": "build/uninstallerSidebar.bmp",
"license": "xxxxxxxx",
},
"win": {
"target": [
"nsis"
],
"icon": "build/icon.ico",
"files": [
"!release-builds/*",
"!build/*",
"!.vscode/*",
"!.gitignore/*"
]
}
},
"author": "xxxxxxxx",
"license": "UNLICENSED",
"dependencies": {
"@fortawesome/fontawesome-free": "^5.9.0",
"about-window": "^1.13.0",
"bootstrap": "^4.3.1",
"d3": "^5.9.7",
"d3-context-menu": "^1.1.1",
"electron-store": "^3.3.0",
"fast-csv": "^2.5.0",
"featherlight": "^1.7.13",
"font-awesome": "^4.7.0",
"fs-jetpack": "^2.2.2",
"handlebars": "^4.1.2",
"jquery": "^3.4.1",
"json-format": "^1.0.1",
"jsonfile": "^2.4.0",
"lg-fullscreen": "^1.1.0",
"lg-pager": "^1.0.2",
"lg-video": "^1.2.2",
"lg-zoom": "^1.1.0",
"lightgallery": "^1.6.12",
"melanke-watchjs": "^1.5.0",
"moment": "^2.24.0",
"mousetrap": "^1.6.3",
"os": "^0.1.1",
"path": "^0.12.7",
"popper.js": "^1.15.0",
"semver-parser": "^3.0.1",
"spectrum-colorpicker": "^1.8.0",
"tabulator-tables": "^4.2.7",
"upath": "^1.1.2",
"video.js": "^7.5.5",
"videojs-offset": "^2.1.2",
"xlsx": "^0.14.3"
},
"devDependencies": {
"electron": "^4.2.6",
"electron-builder": "^20.44.4",
"electron-notarize": "^0.1.1",
"electron-packager": "^13.1.1",
"electron-reload": "^1.4.0"
}
}