1、新增路径
package.json或者vue.config.js下NSIS新增

include: './public/installer.nsh'

注意,这里的./指的是当前package.json或者vue.config.js,而不是打包之后的
2、新增installer.nsh

!macro preInit
    SetRegView 64
    WriteRegExpandStr HKLM "${INSTALL_REGISTRY_KEY}" InstallLocation "C:\\windows\\abc"
    WriteRegExpandStr HkCU "${INSTALL_REGISTRY_KEY}" InstallLocation "C:\\windows\\abc"
    SetRegView 32
    WriteRegExpandStr HKLM "${INSTALL_REGISTRY_KEY}" InstallLocation "C:\\windows\\abc"
    WriteRegExpandStr HkCU "${INSTALL_REGISTRY_KEY}" InstallLocation "C:\\windows\\abc"
!macroend

最后运行yarn run electron:build 打包成功

Logo

前往低代码交流专区

更多推荐