electron-builder中NSIS相关配置

electron-builder中NSIS相关配置

相比较于electron-packager打包,使用electron-builder打包使得包体积更小。在electron-builder中,对于NSIS的配置,也是支持的node

electron-builder中nsis如何设置:https://www.electron.build/configuration/nsis数组

本片文章,将会详细阐述几点须要注意的地方。app

1,electron-builder打包路径和开发路径不一致。electron

2,electron-builder打包中若须要对专门的文件有读写的权限,则应将文件加入到asarUnpack数组中 。ui

3,在“build”属性中须要设置一个属性:"extends": null(具体缘由这方面尚未琢磨清楚),多是因为NSIS自己的属性,不须要去继承。都是用户自定义配置。spa

"build": { 
  "appId": "com.test", "asarUnpack": ["./test.txt","./test.ico" ], "files": [ "./main.js", "./build${/*}",
"./node_modules${/*}", "./src${/*}", "./public${/*}","./test.ico",
    "./test.txt"
], "win": { "target": [ "nsis", "zip" ], "icon": "./satellite.png" }, "nsis": { "oneClick": false, "allowElevation": true, "allowToChangeInstallationDirectory": true, "installerIcon": "./test.ico", "uninstallerIcon": "./test.ico", "installerHeaderIcon": "./test.ico", "createDesktopShortcut": true, "createStartMenuShortcut": true, "perMachine": true,"unicode": true }, "extends": null }

以上是关于build的完整配置,从配置中,能够看到,咱们须要对“test.txt”进行操做,因此将,这个文件放到asarUnpack下。code

相关文章
相关标签/搜索