用electrion官網的不行。node
還好,能夠直接照搬 https://github.com/maximegris/angular-electronlinux
安裝必要的庫git
npm i --save-dev electron electron-builder electron-reload npm-run-all wait-on
須要從angular-electron 裏複製出來:github
./下的web
main.tsnpm
tsconfig.jsonjson
tsconfig.app.jsonwindows
tsconfig-serve.jsonapp
postinstall.jselectron
postinstall-web.js
electron-builder.json
須要參考修改的: 懶得修改,直接照搬
package.json
"main": "main.js", //增長 "scripts": { "postinstall": "npm run postinstall:electron && electron-builder install-app-deps", "postinstall:web": "node postinstall-web", "postinstall:electron": "node postinstall", "ng": "ng", "start": "npm run postinstall:electron && npm-run-all -p ng:serve electron:serve", "build": "npm run postinstall:electron && npm run electron:serve-tsc && ng build", "build:dev": "npm run build -- -c dev", "build:prod": "npm run build -- -c production", "ng:serve": "ng serve", "ng:serve:web": "npm run postinstall:web && ng serve -o", "electron:serve-tsc": "tsc -p tsconfig-serve.json", "electron:serve": "wait-on http-get://localhost:4200/ && npm run electron:serve-tsc && electron . --serve", "electron:local": "npm run build:prod && electron .", "electron:linux": "npm run build:prod && electron-builder build --linux", "electron:windows": "npm run build:prod && electron-builder build --windows", "electron:mac": "npm run build:prod && electron-builder build --mac", "test": "npm run postinstall:web && ng test", "e2e": "npm run build:prod && mocha --timeout 300000 --require ts-node/register e2e/**/*.spec.ts", "version": "conventional-changelog -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md", "lint": "ng lint" },