简体   繁体   English

带电子的Angular2 CLI

[英]Angular2 CLI with electron

I am trying to set up an Angular2 CLI project in electron and am not quite sure where to start after getting the basic Angular piece generated by the CLI set up. 我试图在电子中建立一个Angular2 CLI项目,但是在获得由CLI设置生成的基本Angular片段后,我不确定从哪里开始。

I have used Angular2 with electron successfully before, but that was not with the CLI piece. 之前我已经成功地将Angular2与电子一起使用,但是CLI却没有。

So, for clarification, I have generated the basic Angular2 App using the Angular2 CLI. 因此,为澄清起见,我使用Angular2 CLI生成了基本的Angular2 App。 Now I am unsure of how to wire it up with Electron. 现在我不确定如何将其与Electron连接起来。

Has anyone done this before? 有人做过吗? Maybe you could provide some insight. 也许您可以提供一些见解。 Any tidbits of help will be greatly appreciated. 任何帮助的小窍门将不胜感激。

Thanks! 谢谢!

just figured I'd let you all know the solution I found. 只是想让我知道我找到的解决方案。 Turns out when you do an ng-build using the CLI it is completely dropping the dist folder and then remakes it using the src folder. 原来,当您使用CLI进行ng-build时,它会完全删除dist文件夹,然后使用src文件夹对其进行重新制作。 This means it gets rid of the main.js, renderer.js, and package.json electron needs which are stored in the dist folder. 这意味着它摆脱了存储在dist文件夹中的main.js,renderer.js和package.json电子需求。

In order to ensure the Electron files (main.js, package.json, and renderer.js) get carried over to the Dist folder each time I use ng build, I set up a task using GulpJS to copy them to the correct location. 为了确保每次使用ng build时都将Electron文件(main.js,package.json和renderer.js)转移到Dist文件夹中,我使用GulpJS设置了一个任务,将它们复制到正确的位置。 Anyways, hope this helps anyone facing the same issue! 无论如何,希望这可以帮助遇到相同问题的任何人!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM