最近在研究electron,考虑到以前一直用PhpStorm做开发,而且electron就是基于nodejs的,因此很自然的想到要继续用PhpStorm做IDE。

开发

打开Run/Debug Configurations窗口,添加一个Node.js配置:
使用PhpStorm或WebStorm作为electron IDE_第1张图片

然后配置Node Interpreter参数,对于windows系统,配置为项目目录下的node_modules.bin\electron.cmd。JavaScript file参数,配置为main.js:
使用PhpStorm或WebStorm作为electron IDE_第2张图片

调试

打开Run/Debug Configurations窗口,配置Application parameters参数:
--remote-debugging-port=9222
使用PhpStorm或WebStorm作为electron IDE_第3张图片

开启nodejs代码辅助

未开启nodejs代码辅助之前,IDE内会有提示:
使用PhpStorm或WebStorm作为electron IDE_第4张图片
开启方法:
使用PhpStorm或WebStorm作为electron IDE_第5张图片