搜索文档
(1)安装 nodemon
1npm i nodemon -D
(2)修改 package.json 的 start 命令
package.json
start
1{ 2 "scripts": { 3 "start": "nodemon --exec electron ." 4 } 5}
(3)配置 nodemon.json 规则
nodemon.json
1{ 2 "ignore": ["node_modules", "dist"], 3 "restartable": "r", 4 "watch": ["*.*"], 5 "ext": "html,js,css" 6}
配置好以后,当代码修改后,应用就会自动重启了。