electron学习-02:electron 热启动功能(解决每次修改代码后都需要重新启动的问题)
安装nodemon
npm i -D nodemon
配置 启动项
# package.json"scripts": {"start": "nodemon --exec electron . --ext .js,.css,.html"},
–ext .js,.css,.html
保存 对应的类型文件后会自动重启(如js、css、html文件等,可自行添加其他文件类型
启动
npm start
package.json中的完整代码
{"name": "vue-progrem","version": "1.0.0","description": "","main": "index.js","scripts": {"start": "nodemon --exec electron . --ext .js,.css,.html"},"keywords": [],"author": "","license": "ISC","devDependencies": {"electron": "^19.0.0","electron-win-state": "^1.1.22","nodemon": "^2.0.22"}
}