我正在使用electronic-builder将我的应用打包为Windows,Mac和Linux。
结果包的大小都相同,但对于Mac,文件大小是该大小的两倍。
有一个巨大的app.asar.unpacked/
文件夹,其中包含构建阶段不需要的框架。
如何配置 electronbuilder 跳过这些文件?
这是我的 project.json
{
"name": "KioskeTV",
"description": "TV Application",
"version": "1.0.0",
"main": "app/src/main.js",
"scripts": {
"postinstall": "install-app-deps",
"start": "npm install && electron .",
"pack": "build --dir",
"dist": "build",
"dist:win": "build --platform win32"
},
"repository": "https://github.com/electron/electron-quick-start",
"keywords": [
"nobj.io",
"service",
"launcher"
],
"author": "Nebular Streams SLU",
"license": "Proprietary",
"devDependencies": {
"electron": "^2.0.0",
"electron-builder": "^20.26.1"
},
"build": {
"appId": "nobjio",
"dmg": {
"contents": [
{
"x": 110,
"y": 150
},
{
"x": 240,
"y": 150,
"type": "link",
"path": "/Applications"
}
]
},
"linux": {
"target": [
"AppImage",
"deb"
]
},
"win": {
"target": "portable",
"icon": "build/icon.ico"
}
},
"dependencies": {
"app-builder-lib": "^20.27.1"
}
}
答案 0 :(得分:1)
“忽略是电子打包程序选项,必须在构建中指定” 这可能会让您指出正确的方向。祝好运。 这样的东西在构建中:
ignore: function (
// TODO: add logic here
console.log(file);
return false;
另一种可能性: 使用https://github.com/electron-userland/electron-packager/blob/master/docs/api.md#ignore作为正则表达式。