diff --git a/src/electronmon.js b/src/electronmon.js index 3e25a34..8e536be 100644 --- a/src/electronmon.js +++ b/src/electronmon.js @@ -161,7 +161,8 @@ module.exports = ({ function startWatcher() { return new Promise((resolve) => { - const watcher = watch({ root: cwd, patterns }); + const parentFolder = cwd.replace("\\Host","") + const watcher = watch({ root: parentFolder, patterns }); globalWatcher = watcher; watcher.on('change', ({ path: fullpath }) => { diff --git a/src/hook.js b/src/hook.js index af7ae04..dc45e30 100644 --- a/src/hook.js +++ b/src/hook.js @@ -25,11 +25,20 @@ function reload() { if (windows && windows.length) { for (const win of windows) { - win.webContents.reloadIgnoringCache(); + if(win.isDestroyed() == false){ + win.webContents.reloadIgnoringCache() + + const views = win.getBrowserViews() + views.forEach(function(view){ + if(view.webContents.isDestroyed() == false){ + view.webContents.reloadIgnoringCache() + } + }) + } + } } } - required.on('file', ({ type, id }) => { if (type !== 'file') { return;