Skip to content

Commit

Permalink
fix: ensure directories are watched, not files
Browse files Browse the repository at this point in the history
Fixes #1259
  • Loading branch information
remy authored Feb 16, 2018
1 parent 70cfb7d commit fab3db6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/monitor/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit fab3db6

Please sign in to comment.