package.json 中的更改:
增加:
"homepage": "./", "build": { "productName": "xxxx", "appId": "com.xxx.win", "directories": { "output": "dist" }, "files": [ "dist/**/*", "public/**/*", "main.js", "package.json", "preload.js", "src/**/*" ], "win": { "target": [ "nsis" ], "icon": "public/256.ico" }, "nsis": { "oneClick": false, "perMachine": false, "allowElevation": false, "allowToChangeInstallationDirectory": true, "installerIcon": "public/256.ico", "uninstallerIcon": "public/256.ico", "installerHeader": "public/background.png", "installerHeaderIcon": "public/256.ico", "createDesktopShortcut": true, "createStartMenuShortcut": true, "shortcutName": "xxx" } 安装 打包工具:npm install electron-builder --save-dev 打包指令: "electron-start": "electron .", "dist": "electron-builder --win --ia32", "distmac": "electron-builder --mac" 标签:ico,--,react,electron,dist,256,public,打包 From: https://www.cnblogs.com/wxhhts/p/17773087.html