diff --git a/lib/monitor/watch.js b/lib/monitor/watch.js index 6fd5b9aa..19b8d508 100644 --- a/lib/monitor/watch.js +++ b/lib/monitor/watch.js @@ -7,6 +7,7 @@ var chokidar = require('chokidar'); var undefsafe = require('undefsafe'); var config = require('../config'); var path = require('path'); +const fs = require('fs'); var utils = require('../utils'); var bus = utils.bus; var match = require('./match'); @@ -48,6 +49,12 @@ function watch() { ignored.push(dotFilePattern); } + // if the directory is a file, it somehow causes + // windows to lose the filename upon change + if (fs.statSync(dir).isFile()) { + dir = path.dirname(dir); + } + var watchOptions = { ignorePermissionErrors: true, cwd: dir,