In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
How to package and configure electron-builder? in view of this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and easy way.
The editor introduces the direct configuration and use in package.json:
1. Basic configuration "build": {/ / here is the configuration of electron-builder "productName": "xxxx", / / the project name, which is also the prefix name of the generated exe file "appId": "com.xxx.xxxxx", / / package name "copyright": "xxxx", / / copyright information "directories": {/ / output folder "output": "build"} / / windows-related configuration "win": {"icon": "xxx/icon.ico" / / icon path}} 2. Package target configuration "win": {/ / change the options under build "icon": "build/icons/aims.ico", "target": [{"target": "nsis" / / the target installation package we want}]}, 3. Other platform configurations "dmg": {/ / macOSdmg "contents": [...]}, "mac": {/ / mac "icon": "build/icons/icon.icns"}, "linux": {/ / linux "icon": "build/icons"} 4.nsis configuration "nsis": {"oneClick": false / / whether to install "allowElevation": true with one click, / / allow request for promotion. If false, the user must restart setup with elevated privileges. "allowToChangeInstallationDirectory": true, / / allows you to modify the installation directory "installerIcon": ". / build/icons/aaa.ico", / / installation icon "uninstallerIcon": ". / build/icons/bbb.ico", / / uninstall icon "installerHeaderIcon": ". / build/icons/aaa.ico", / / install header icon "createDesktopShortcut": true, / / create desktop icon "createStartMenuShortcut": true / / create the start menu icon "shortcutName": "xxxx", / / the icon name "include": "build/script/installer.nsh", / / contains custom nsis scripts that are useful for building the installation process that requires strict requirements. }, 5. About the configuration of the operating system
CLI parameter
Electron-builder-ia32 / / 32-bit electron-builder / / 64-bit (default)
Configuration in nsis
"win": {"icon": "build/icons/aims.ico", "target": [{"target": "nsis", "arch": [/ / this means typing out a package of 32 bit + 64 bit, but note: the installation package packaged in this way is relatively large, so it is recommended to hit the 32 installation package directly. "x64", "ia32"]}]} 6. Update configuration "publish": [{"provider": "generic", / / server provider can also be GitHub, etc. "url": "http://xxxxx/" / / server address}]
Complete configuration
"build": {"productName": "xxxx", / / Project name this is also the prefix name of the generated exe file "appId": "com.leon.xxxxx", / / package name "copyright": "xxxx", / / copyright information "directories": {/ / output folder "output": "build"}, "nsis": {"oneClick": false / / whether to install "allowElevation": true with one click, / / allow request for promotion. If false, the user must restart setup with elevated privileges. "allowToChangeInstallationDirectory": true, / / allows you to modify the installation directory "installerIcon": ". / build/icons/aaa.ico", / / installation icon "uninstallerIcon": ". / build/icons/bbb.ico", / / uninstall icon "installerHeaderIcon": ". / build/icons/aaa.ico", / / install header icon "createDesktopShortcut": true, / / create desktop icon "createStartMenuShortcut": true / / create the start menu icon "shortcutName": "xxxx", / / Icon name "include": "build/script/installer.nsh", / / Custom nsis script included}, "publish": [{"provider": "generic" / / the server provider can also be GitHub, etc. "url": "http://xxxxx/" / / server address}]," files ": [" dist/electron/**/* "]," dmg ": {" contents ": [{" x ": 410," y ": 150 "type": "link", "path": "/ Applications"}, {"x": 130,150, "type": "file"}]}, "mac": {"icon": "build/icons/icon.icns"} "win": {"icon": "build/icons/aims.ico", "target": [{"target": "nsis", "arch": ["ia32"]}]} "linux": {"icon": "build/icons"}} answers to questions about how electron-builder should be packaged and configured are shared here. I hope the above content can help you to a certain extent, if you still have a lot of doubts to be solved, you can follow the industry information channel to learn more related knowledge.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.