资料
官方文档
https://www.electronjs.org/
hello world
# 克隆示例项目的仓库
$ git clone https://github.com/electron/electron-quick-start
# 进入这个仓库
$ cd electron-quick-start
# 安装依赖并运行
$ npm install && npm start
运行效果如下
nodemon
简单使用
npm install --save-dev nodemon
修改package.json
的script
为:
"scripts": {
"start": "nodemon --watch main.js --exec \"electron .\""
}
此时运行npm start
, 修改main.js即可实现修改后自动重启
nodemon 配置
参考
www.cnblogs.com/JuFoFu/p/5140302.html
参考配置如下
{
"restartable": "r",
"ignore": [
".git",
"node_module",
".idea"
],
"verbose": true,
"execMap": {
"": "node",
"js": "node --harmony"
},
"events": {
"start": "echo 'app start'",
"restart": "echo 'app restart'"
},
"watch": [
"**.html",
"**.js"
],
"env": {
"NODE_ENV": "development",
"PORT": "3000"
},
"ext": "js html",
"legacy-watch": false
}