第一个方式
cnpm install electron-reload --save-dev
cnpm install electron-prebuilt --save-dev
require('electron-reload')(__dirname,{
electron:require("electron-prebuilt")
});
第二个方式
cnpm install electron-connect --save-dev
cnpm install gulp --save-dev
var gulp = require('gulp');
var electron = require('electron-connect').server.create();
gulp.task('watch:electron', function () {
electron.start();
gulp.watch(["./src/**/*.js"], electron.restart);
gulp.watch(['./src/windows/**/*.{html,js,css}'], electron.reload);
});
var client = require('electron-connect').client;
client.create(new BrowserWindow());