晚上好,
Create Project
使用angular-cli开始新项目ng new electron-ng2-cli --style=scss
安装Electron 和electron-builder
Edit package.json
Make the following additions...
"main": "main.js"
"build":
{
"appId": "com.electrontest.testapp",
"mac": {
"category": "your.app.category.type"
}
}
并将以下内容添加到scripts
...
"pack": "build --dir",
"dist": "build",
"electron": "electron main.js",
"postinstall": "install-app-deps"
Create main.js
我刚刚复制了electron quick start的代码.我所做的唯一更改是将位置index.html
设置为/dist/index.html
Amend base
在index.html
中,将<base="/">
改为<base="./">
Pack code
跑ng build
.这将所有打包的代码放入/dist
Test Run
跑npm run electron
.这个很好用.一个Electron 应用程序启动了,我看到里面运行着有棱角的东西.
Create App For Distribution
运行npm run pack
创建打包应用程序.包装似乎还行——我收到了一个关于丢失图标的警告,以及一个关于我的代码未签名的警告,但我猜它们不应该是致命的
So, can anyone explain what is different between the packaged app that fails and the one that runs ok when I use
npm run electron
?
我能做些什么来解决这个问题并让应用程序正常运行?
谢谢你坚持到最后.这比我想要的要长,但我希望我已经解释清楚了.如果你能提供帮助或给出任何建议,那将是很棒的-许多好的共鸣会在你的总体方向上被认为是:)
干杯